Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

CMD / Batchfile Hell!

  • 07-11-2006 1:47am
    #1
    Closed Accounts Posts: 511 ✭✭✭


    Okay i've spent about a half hour trying to sort this and i cant, hopefully somone on here can help.

    I'm writing a batch file that when run will delete everything from the "My Music" folder. Easier said than done for some reason.

    The command i'm using is he rmdir command. The problem is this that i dont appear to be able to put spaces in the command. For example if i create a called in C: called "Pretend Music" and then run the command:

    "rmdir/s C:\prented music"

    It wont work, where if i change the folder name to like "OnWord" and then run "rmdir/s C:\OneWord" it works grand.

    Any idea how i run the command with spaces in it as changing the "My Music" folder name isnt an option.

    Cheers Guys!!


Comments

  • Registered Users, Registered Users 2 Posts: 1,065 ✭✭✭Snowbat


    Enclose the drive,path,filename in doublequotes:

    rmdir/s "C:\prented music"


  • Registered Users, Registered Users 2 Posts: 19,396 ✭✭✭✭Karoma


    folders/files with spaces in names should be enclosed in quotes.
    ex: rmdir "My Music"

    Otherwise, use the shortname. (dir /x will tell what this is. ex: MYMUSI~1 [Note: total short file name = 8chars])


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    rmdir? what year is this :)

    rd /S/Q "C:\My Music"
    md "C:\My Music"


  • Closed Accounts Posts: 511 ✭✭✭Undercoverguy


    Okay two small problems.

    "rm" isnt a valid command.

    Also i'm getting access denied to My Music when i try to delete.

    Any ideas anyone?

    Like i said i'm trying to create a catch file that when runs deletes everything in the "My Music" folder.

    The dir for this will be "C:\Documents and Settings\PC\My Documents\My Music"

    Any help would be great,

    Cheers Guys


  • Closed Accounts Posts: 511 ✭✭✭Undercoverguy


    Ah Change of plan....

    It's healed!! Cheers guys!

    One question tho for future reference, if there a command that can delete files and folders. I know files can be deleted with "del/q C:\example\*.*" but is there a similar command for folders too?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    should be rd not rm.

    Also you won't be able to nuke the directory if anything has the directory open or a file open in that area.


Advertisement