This is my script: @echo off setlocal ??? for %%F in (*.mkv) do ( ffmpeg -hidebanner -y…
- User
This is my script:
@echo off setlocal ???
for %%F in (*.mkv) do (
codeffmpeg -hide_banner -y -i "%%F" ^ -map 0:a:m:language:eng -af "aresample=50050:resampler=soxr:precision=33,asetrate=48000" ^ -compression_level 0 -sample_fmt s32 -map_metadata -1 "%%~nF.eng.flac" ^ -map 0:a:m:language:dan -af "aresample=50050:resampler=soxr:precision=33,asetrate=48000" ^ -compression_level 0 -sample_fmt s32 -map_metadata -1 "%%~nF.dan.flac" mkvmerge -o "%%~nF.resampled.mkv" --no-chapters --no-audio --default-duration 0:24000/1001p "%%F" ^ --track-name "0:FLAC English" --language 0:eng "%%~nF.eng.flac" ^ --track-name "0:FLAC Danish" --language 0:dan "%%~nF.dan.flac")
pause
"???" is a placeholder, because I'm not sure whether to use "enableextensions disabledelayedexpansion" or "enabledelayedexpansion there. What do you think would be best? And do I even need the "setlocal" line in this script or can I omit it?
- Assistant
You can omit the
setlocalline entirely in your script since you aren't modifying any environment variables or using features that require delayed variable expansion. The FOR loop you're using relies on command extensions, but these are enabled by default in the Windows Command Prompt unless explicitly disabled.If you want to be explicit or are running in an environment where extensions might be disabled by default, you could include
setlocal enableextensionsto ensure command extensions are enabled. However, you don't need to enable delayed variable expansion because your script doesn't modify variables within the loop or require variable values to be updated within the same loop iteration.