FOR
- when using variables in batch files, use <html>%%i instead of %i</html>
delete .tmp files in a given directory
remove_tmp_files.bat
@ECHO OFF cd "C:\somedir" FOR %%f in (*.*) do if %%~xf == .tmp del "%%f"
docs:programming:batch_files:for
remove_tmp_files.bat
@ECHO OFF cd "C:\somedir" FOR %%f in (*.*) do if %%~xf == .tmp del "%%f"