@ECHO off SETLOCAL IF [%1] NEQ [] goto s_start :: Author - Simon Sheppard, July 2003 :: Tested for Windows NT, 2K, XP ECHO STAMPME.cmd ECHO REName a file with the DATE/Time ECHO. ECHO SYNTAX ECHO STAMPME TestFile.txt ECHO. ECHO STAMPME "Test File.txt" ECHO. ECHO STAMPME "c:\docs\Test File.txt" ECHO. ECHO Will rename the file in the format "Test File-02-12-27@16-55.txt" ECHO. ECHO In a batch file use CALL STAMPME ... :: To change the filename format just change around the last line below GOTO :eof :s_start SET v_file=%~n1% SET v_pathname=%~f1% SET v_ext=%~x1% ::Get the date :: note ISO 8601 date format would require 4 digit YYYY Year) FOR /f "tokens=6-8 delims=/ " %%G IN ('NET TIME \\%computername%') DO ( SET v_mm=%%G SET v_dd=%%H SET v_yy=%%I ) :: Get the time FOR /f "tokens=1,2 delims=: " %%G IN ('time/t') DO ( SET v_hr=%%G SET v_min=%%H ) ECHO Today is Year: [%v_yy%] Month: [%v_mm%] Day: [%v_dd%] ECHO The time is: [%v_hr%]:[%v_min%] REN "%v_pathname%" "%v_file%-%v_yy%-%v_mm%-%v_dd%@%v_hr%-%v_min%%v_ext%"