マップされたドライブがあり、そのドライブにはファイルを含む一意の名前の付いた複数のフォルダーがあります。バッチ ファイルを使用して各フォルダーの名前を変更したいと考えています。
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*"