批处理文件创建另一个文件,没有 "push" ren 到另一个文件
Batch file creating another file, didnt "push" ren to another file
我在尝试从批处理文件创建批处理文件时遇到问题:
test.bat:
echo set "newname=%%newname%: =%%" >> batchfile.bat
echo set "newname=%%newname%:‚=e%%" >> batchfile.bat
echo set "newname=%%newname%: =_%%" >> batchfile.bat
echo set "newname=%%newname%:ý=r%%" >> batchfile.bat
echo set "newname=%%newname%:ˇ=i%%" >> batchfile.bat
echo ren %1 "%%newname%% >> batchfile.bat"
但是在执行test.bat之后,这是batchfile.bat
中出现的
batchfile.bat
set "newname=%~nx1"
set "newname=%newname: =%"
set "newname=%newname:‚=e%"
set "newname=%newname: =_%"
set "newname=%newname:ý=r%"
set "newname=%newname:ˇ=i%"
有人知道问题出在哪里吗?
您的批处理文件的最后一行是:
echo ren %1 "%%newname%% >> batchfile.bat"
结尾的 "
位置错误(行尾)。
尝试以下操作:
echo ren %1 "%%newname%%" >> batchfile.bat
我在尝试从批处理文件创建批处理文件时遇到问题:
test.bat:
echo set "newname=%%newname%: =%%" >> batchfile.bat
echo set "newname=%%newname%:‚=e%%" >> batchfile.bat
echo set "newname=%%newname%: =_%%" >> batchfile.bat
echo set "newname=%%newname%:ý=r%%" >> batchfile.bat
echo set "newname=%%newname%:ˇ=i%%" >> batchfile.bat
echo ren %1 "%%newname%% >> batchfile.bat"
但是在执行test.bat之后,这是batchfile.bat
中出现的batchfile.bat
set "newname=%~nx1"
set "newname=%newname: =%"
set "newname=%newname:‚=e%"
set "newname=%newname: =_%"
set "newname=%newname:ý=r%"
set "newname=%newname:ˇ=i%"
有人知道问题出在哪里吗?
您的批处理文件的最后一行是:
echo ren %1 "%%newname%% >> batchfile.bat"
结尾的 "
位置错误(行尾)。
尝试以下操作:
echo ren %1 "%%newname%%" >> batchfile.bat