我写信给你,是因为我需要创建一个批处理文件,该文件允许我重命名.pdf中的许多文件,而只保留前50个字符。
我已经尝试过了:
for %i in (*.txt) do (set fName=%i)
ren %fName% %fName:~0,-11%.txt
但是这只会删除最后11个字符。 我试图修改此代码,但是我无法做任何我需要的事情。
对于一个比我高一些的人,我认为这是一件很容易的事情,所以我问你是否可以帮助我。
谢谢。
我在更正后出现的错误下方插入:
C:\Users\---\Desktop\Conversione PDFA>for %fname:~0,50% in (*.pdf) do (set fname=%~ni)
graeiojpoghnpiofsdnpibnwapobnslnsdlekpfèwekrgpjbm was unexpected at this time.
C:\Users\---\Desktop\Conversione PDFA>for %fname:~0,50% in (*.pdf) do (set fname=%i)
graeiojpoghnpiofsdnpibnwapobnslnsdlekpfèwekrgpjbm was unexpected at this time.
C:\Users\---\Desktop\Conversione PDFA>ren %fName% !fname:~0,50!.pdf
The syntax of the command is incorrect.
C:\Users\---\Desktop\Conversione PDFA>ren %fName% %!fname:~0,50!.pdf
The syntax of the command is incorrect.