|
|
发表于 2022-12-5 15:57:57
|
显示全部楼层
本帖最后由 tmplinshi 于 2022-12-5 16:21 编辑
- @echo off
- for %%a in (*.flac) do (
- call :ReplaceSingleQuotes "%%~na" newNameNoExt
- set "oldName=%%a"
- setLocal enableDelayedExpansion
- ffmpeg -y -i "!oldName!" -acodec pcm_s24le -ar 48000 "!newNameNoExt!.wav"
- endLocal
- )
- pause
- exit /b
- :ReplaceSingleQuotes <inputStr> <outputVar>
- setLocal disableDelayedExpansion
- set "inputStr=%~1"
- set "inputStr=%inputStr:^^=^%"
- set "outputVar=%~2"
- set "outputStr="
- if "%inputStr:'=%" == "%inputStr%" (
- endLocal & set "%outputVar%=%inputStr%" & exit /b
- )
- set isLeftQuote=true
- set leftQuote=‘
- set rightQuote=’
- setLocal enableDelayedExpansion
- for /l %%i in (0 1 1000) do (
- set c=!inputStr:~%%i,1!
- if "!c!" == "" (goto :ReplaceSingleQuotes_Finish)
- if "!c!" == "'" (
- if !isLeftQuote! == true (
- set c=%leftQuote%
- set isLeftQuote=false
- ) else (
- set c=%rightQuote%
- set isLeftQuote=true
- )
- )
- set "outputStr=!outputStr!!c!"
- )
- :ReplaceSingleQuotes_Finish
- endLocal & endLocal & set "%outputVar%=%outputStr%"
- exit /b
复制代码 |
评分
-
查看全部评分
|