를 처리 할 수 없습니다 :이 문자 제거제 내가 (일부 심미적 인 변화와 함께) 파일 이름에서 귀찮은 문자를 제거 스크립트를 퍼센트 기호
set "fullpath=%~dp1"
set "file=%~n1"
set "ext=%~x1"
echo "%~nx1" | find /i ".tmp" >nul && exit /b
:: replace problem characters (add additional dash replacements via perl)
set "original=%file%"
set "file=%file:!=%"
set "file=%file:#=%"
set "file=%file:’='%"
set "file=%file:“=%"
set "file=%file:”=%"
set "file=%file:at&t=ATT%"
set "file=%file:&=and%"
:: additional requirements
set "file=%file: _ = - %"
set "file=%file: = %"
set "file=%file: = %"
:: replace underscores and dots only if used as spaces
echo "%file%"| find " " >nul || set "file=%file:_= %"
echo "%file%"| find " " >nul || set "file=%file:.= %"
:: exclamation point has to be removed before we enable delayed expansion
if not "%file%"=="%original%" ren "%fullpath%%original%%ext%" "%file%%ext%" 2>nul && echo validated "%original%%~x1"
:: remove percent sign
setlocal enabledelayedexpansion
set "original=!file!"
:: this percent replacement produces an error (because was not removed)
set "file=!file:%%=_percent!"
if not "%file%"=="%original%" ren "%fullpath%%original%%ext%" "%file%%ext%" 2>nul && echo validated "%original%%ext%"
set "original=!file!"
:: this needs to remain separated in order to add s01 tag if no season tag present
@for /l %%s in (0,1,9) do set "file=!file:series.%%s.=S0%%s!"
@for /l %%e in (0,1,9) do set "file=!file:%%eof2=E0%%e!"
@for /l %%e in (0,1,9) do set "file=!file:%%eof3=E0%%e!"
@for /l %%e in (0,1,9) do set "file=!file:%%eof4=E0%%e!"
@for /l %%e in (0,1,9) do set "file=!file:%%eof5=E0%%e!"
@for /l %%e in (0,1,9) do set "file=!file:%%eof6=E0%%e!"
@for /l %%e in (0,1,9) do set "file=!file:%%eof7=E0%%e!"
@for /l %%e in (0,1,9) do set "file=!file:%%eof8=E0%%e!"
@for /l %%e in (0,1,9) do set "file=!file:%%eof9=E0%%e!"
:: if file has changed but no season tag present add s01
if not "%file%"=="%original%" echo "%file%" | find /i "s0" >nul || set "file=!file:E0=S01E0!"
if not "%file%"=="%original%" ren "%fullpath%%original%%ext%" "%file%%ext%" && echo validated "%original%"
endlocal & set "file=%file%" & set "ext=%ext%" & set "fullpath=%fullpath%" & set "full=%fullpath%%file%%ext%"
이 첫 번째 파일에 대한 로그입니다. ... 원래 파일 이름은 원래 모든 문자가없는 것처럼 ... 보이는
d:\VIDEOS\SHORTS\MEDIA RELATED>setlocal enabledelayedexpansion
d:\VIDEOS\SHORTS\MEDIA RELATED>set "original=!file!"
d:\VIDEOS\SHORTS\MEDIA RELATED>set "file=!file:%=_percent!"
d:\VIDEOS\SHORTS\MEDIA RELATED>if not "SUPERCUT_ Where's The [email protected] Money__" == "SUPERCUT_ Where's The [email protected] Money__" ren "d:\VIDEOS\SHORTS\MEDIA RELATED\SUPERCUT_ Where's The [email protected] Money__.mp4" "SUPERCUT_ Where's The [email protected] Money__.mp4" 2>nul && echo validated "SUPERCUT_ Where's The [email protected] Money__.mp4"
이 환영 전체 파일 이름
SUPERCUT_ Where's The F#@%ing Money_!_!.mp4
Through The Fire And Flames 100% Expert Guitar Hero 3.mp4
Top 10 F_#% Ups in Video Game History.mp4
어떤 제안, 개선 때문이다.
나는 어떤 문제를 볼 수 없습니다. "test.bat xy! z %"명령 줄에서 시작하면 예상대로 작동합니다. 일괄 처리/함수를 어떻게 호출합니까? – jeb
은 여기에/f "delims ="%% v in을 사용합니다. "% cd % \ %% v"' – bricktop