注意,后来这个改变了当前路径的,请仔细看清楚"CD %1",不将这个批处理放在目标目录里就不会被改
请先测试一下代码
保存成批处理,然后把要批量改名的批处理所在文件夹拖放到这个批处理上,这样就解决自己也被改成txt的问题
不过我也发现问题了,CD只更改路径,不切换盘符,非C盘的文件夹还是不行,改成pushd即可
if "%1" equ "" exit
pushd %1
ren *.cmd *.txt
ren *.bat *.txt
Last edited by gahoo on 2008-5-19 at 06:31 PM ]
Note that this later changed the current path. Please look carefully at "CD %1". If this batch file is not placed in the target directory, it will not be changed.
Please test the code first.
Save as a batch file, then drag the folder where the batch file to be batch renamed is located onto this batch file, so as to solve the problem that you yourself are also changed to txt.
However, I also found a problem. CD only changes the path, not the drive letter. Folders on non-C drives still don't work. Change it to pushd.
if "%1" equ "" exit
pushd %1
ren *.cmd *.txt
ren *.bat *.txt
Last edited by gahoo on 2008-5-19 at 06:31 PM ]