Defining and using a variable in batch file

The space before the = is interpreted as part of the name, and the space after it (as well as the quotation marks) are interpreted as part of the value. So the variable you’ve created can be referenced with %location %. If that’s not what you want, remove the extra space(s) in the definition.

“if not exist” command in batch file

You have it almost done. The logic is correct, just some little changes. This code checks for the existence of the folder (see the ending backslash, just to differentiate a folder from a file with the same name). If it does not exist then it is created and creation status is checked. If a file … Read more

“if not exist” command in batch file

You have it almost done. The logic is correct, just some little changes. This code checks for the existence of the folder (see the ending backslash, just to differentiate a folder from a file with the same name). If it does not exist then it is created and creation status is checked. If a file … Read more

Moving file using cmd?

To move a file, you use the move command. I put quotes around the source and target in case you’re one of those people who has spaces in their username for some reason (and the target needs them anyway for the spaces in “Start Menu”). From the output of move /?:

“rm -rf” equivalent for Windows?

RMDIR or RD if you are using the classic Command Prompt (cmd.exe): RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path /S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. /Q Quiet mode, do not ask if ok to remove a directory tree with … Read more

“rm -rf” equivalent for Windows?

RMDIR or RD if you are using the classic Command Prompt (cmd.exe): RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path /S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. /Q Quiet mode, do not ask if ok to remove a directory tree with … Read more