How to toggle file names in Windows 7 command-line
I want to toggle the names of two files, using a batch file (Windows 7 command-line). I wrote the following code, but its not working.
IF EXIST test12.txt
rename test.txt test23.txt
rename test12.txt test.txt
Could someone help me correct this code?
Thanks.
EDIT: When I run from the command line, it says "The syntax of th开发者_如何学Ce command is incorrect". What is the syntax then? Is this only for checking the existence of directories?
Not sure if this is what you are asking. Perhaps your IF clause isn't correct. By using () the code should improve.
IF EXIST test12.txt (
rename test.txt test23.txt
rename test12.txt test.txt
)
精彩评论