@echo off goto start :help echo Image preview and rename by HM2K (Updated: 22/10/09) echo Usage: imgrename [image file] echo. echo Example of using this script to rename an entire directory: echo for %%i in (S:\images\*.tif) do ( imgrename.bat "%%i" ) goto end :start if %1()==() goto help if %1==/? goto help if %1==? goto help :check if not exist %1 echo The file '%1' does not exist. && goto end :vars set VIEWIMG=rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen :viewimg start /wait %VIEWIMG% %1 :input set INPUT= set /P INPUT=Enter new name: %=% REM if "%INPUT%"=="" goto input :rename rename %1 %INPUT%%~x1 :end