我有一個映射驅動器,其中有多個包含文件的唯一命名的資料夾。我想用批次檔重命名每個資料夾。
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*"