我有一个映射驱动器,其中有多个包含文件且具有唯一名称的文件夹。我想使用批处理文件重命名每个文件夹。
V:\Media\Elton John\Singles>dir
Volume in drive V is DATA3
Volume Serial Number is 50CF-6A6E
Directory of V:\Media\Elton John\Singles
2021-04-17 05:16 AM <DIR> .
2020-09-22 10:14 AM <DIR> ..
2021-04-09 06:47 AM <DIR> 1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)
2021-04-09 07:36 AM <DIR> 1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)
2021-04-09 06:50 AM <DIR> 1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)
.
.
.
我想用唯一的名称重命名每个唯一命名的目录-例如:
1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)
1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)
我创建了一个批处理文件 - 暂停是为了在出现问题时中止该批处理文件:
ren "1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739)" "1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
PAUSE
ren "1971 - Border Song. Bad Side Of The Moon (7'', UNI 55246)" "1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)"
PAUSE
ren "1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222)" "1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)"
我运行它并得到:
C:\WINDOWS\system32>cd V:\Media\Elton John\Singles\
C:\WINDOWS\system32>V:
V:\Media\Elton John\Singles>C:\Users\Marc\Desktop\EJSingles.bat
V:\Media\Elton John\Singles>ren "1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739)" "1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
The system cannot find the file specified.
V:\Media\Elton John\Singles>PAUSE
Press any key to continue . . .
V:\Media\Elton John\Singles>ren "1971 - Border Song. Bad Side Of The Moon (7'', UNI 55246)" "1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)"
The system cannot find the file specified.
V:\Media\Elton John\Singles>PAUSE
Press any key to continue . . .
V:\Media\Elton John\Singles>ren "1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222)" "1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)"
The system cannot find the file specified.
V:\Media\Elton John\Singles>
我去掉了引号并得到了:
V:\Media\Elton John\Singles>C:\Users\Marc\Desktop\EJSingles.bat
V:\Media\Elton John\Singles>ren 1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739) 1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)
The syntax of the command is incorrect.
V:\Media\Elton John\Singles>PAUSE
Press any key to continue . . .
V:\Media\Elton John\Singles>ren 1971 - Border Song. Bad Side Of The Moon (7'', UNI 55246) 1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)
The syntax of the command is incorrect.
V:\Media\Elton John\Singles>PAUSE
Press any key to continue . . .
V:\Media\Elton John\Singles>ren 1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222) 1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)
The syntax of the command is incorrect.
V:\Media\Elton John\Singles>
我添加了批处理文件的完整路径:
ren "V:\Media\Elton John\Singles\1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739)" "V:\Media\Elton John\Singles\1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
PAUSE
ren "V:\Media\Elton John\Singles\1970 - Take Me To The Pilot. Your Song (7'', UNI 55265)" "V:\Media\Elton John\Singles\1970-10 Take Me To The Pilot - Your Song (7'', UNI 55265)"
PAUSE
ren "V:\Media\Elton John\Singles\1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222)" "V:\Media\Elton John\Singles\1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)"
我有:
V:\Media\Elton John\Singles>C:\Users\Marc\Desktop\EJSingles.bat
V:\Media\Elton John\Singles>ren "V:\Media\Elton John\Singles\1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739)" "V:\Media\Elton John\Singles\1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
The system cannot find the file specified.
V:\Media\Elton John\Singles>PAUSE
Press any key to continue . . .
V:\Media\Elton John\Singles>ren "V:\Media\Elton John\Singles\1970 - Take Me To The Pilot. Your Song (7'', UNI 55265)" "V:\Media\Elton John\Singles\1970-10 Take Me To The Pilot - Your Song (7'', UNI 55265)"
The system cannot find the file specified.
V:\Media\Elton John\Singles>PAUSE
Press any key to continue . . .
V:\Media\Elton John\Singles>ren "V:\Media\Elton John\Singles\1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222)" "V:\Media\Elton John\Singles\1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)"
The system cannot find the file specified.
V:\Media\Elton John\Singles>
最后我尝试使用不带引号的完整路径:
V:\Media\Elton John\Singles>C:\Users\Marc\Desktop\EJSingles.bat
V:\Media\Elton John\Singles>ren V:\Media\Elton John\Singles\1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739) V:\Media\Elton John\Singles\1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)
The syntax of the command is incorrect.
V:\Media\Elton John\Singles>PAUSE
Press any key to continue . . .
V:\Media\Elton John\Singles>ren V:\Media\Elton John\Singles\1970 - Take Me To The Pilot. Your Song (7'', UNI 55265) V:\Media\Elton John\Singles\1970-10 Take Me To The Pilot - Your Song (7'', UNI 55265)
The syntax of the command is incorrect.
V:\Media\Elton John\Singles>PAUSE
Press any key to continue . . .
V:\Media\Elton John\Singles>ren V:\Media\Elton John\Singles\1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222) V:\Media\Elton John\Singles\1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)
The syntax of the command is incorrect.
V:\Media\Elton John\Singles>
我正在使用记事本编写批处理文件-未打开自动换行。
我可能忘记了一些简单的事情。任何帮助都非常感谢。
答案1
1.前往您的/D
河流:
cd /D "V:\Media\Elton John\Singles\."
2在带有特殊字符和/或空格的路径中使用(继续使用)"
双引号..."
3.目标名称不使用/需要完整路径\文件夹字符串,仅需新名称...
@echo off
cd /D "V:\Media\Elton John\Singles\."
ren .\"1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739)" "1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
ren .\"1971 - Border Song. Bad Side Of The Moon (7'', UNI 55246)" "1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)"
ren .\"1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222)" "1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)"
%__AppDir__%Timeout.exe /t -1 | dir /a:d /b "1969*" "1971*" "1970*"