====== FOR ====== * when using variables in batch files, use %%i instead of %i ===== 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"