开发者

How to toggle file names in Windows 7 command-line

开发者 https://www.devze.com 2023-03-28 16:25 出处:网络
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.

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
)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号