Skip to content

Instantly share code, notes, and snippets.

@LGM-AdrianHum
Last active May 28, 2019 00:24
Show Gist options
  • Save LGM-AdrianHum/d8638a4860347e70be08b8a7e1eee09b to your computer and use it in GitHub Desktop.
Save LGM-AdrianHum/d8638a4860347e70be08b8a7e1eee09b to your computer and use it in GitHub Desktop.
Recursively Loop Across A Directory, execute a command with just the filename without the extension...
@echo off
for /R %%f in (*.ext) do (
echo "%%~nf"
)
pause
The following options are available:
Variable with modifier Description
%~I Expands %I which removes any surrounding
quotation marks ("").
%~fI Expands %I to a fully qualified path name.
%~dI Expands %I to a drive letter only.
%~pI Expands %I to a path only.
%~nI Expands %I to a file name only.
%~xI Expands %I to a file extension only.
%~sI Expands path to contain short names only.
%~aI Expands %I to the file attributes of file.
%~tI Expands %I to the date and time of file.
%~zI Expands %I to the size of file.
%~$PATH:I Searches the directories listed in the PATH environment
variable and expands %I to the fully qualified name of
the first one found. If the environment variable name is
not defined or the file is not found by the search,
this modifier expands to the empty string.
@echo off
for %%f in (*.m4?) do (
c:\ffmpeg\ffmpeg.exe -i "%%f" -acodec libmp3lame -ab 192k "%%~nf.mp3"
)
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment