Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们在一个像这样命名的目录中有几千个文件:
EXP_10000021.XM_
并且需要删除前导 1 所以新的文件名是:
EXP_0000021.XM_
我不擅长批处理文件 - 任何帮助将不胜感激!
如果您的文件名都以EXP_1它开头,那很容易。
EXP_1
setlocal EnableDelayedExpansion for %%A in (EXP_1*.XM_) do ( set "filename=%%A" set "newName=EXP_!filename:~5!" rem ** remove the ECHO when it seems to work ECHO ren !filename! !newName! )