@echo off :: This batch file sets the file created date into :: the environment under Win9x. This kind of thing :: is often needed by scripts trying to determine :: whether or not to update a file. :: It uses the DEBUG command to extract the created :: date from the output of the DIR command. The output :: of the Win9x DIR command is like this: :: TEST BAT 582 04-23-00 11:02p test.bat :: Notice the date starts on the 29th character (hex 1D) :: so we replace the first 28 characters (hex 1C) with :: spaces (hex 20) with this line - "f 100 l 1c 20" :: Then enter the string "set created=" just before :: the date at the 16th character (hex 10) so that :: 16 (our start point) added to the lenghth of :: "set created=" (12 characters) ends us at the 28th :: character. Notice also the created date ends at :: character 36 (hex 24), so we trim things at that :: point (just after the "rcx" line by setting the :: file length to 24 hex. After that, just we just :: Write the file to disk ("w") and quit ("q"). :: If you have NT, you should learn how to use the :: switches in the FOR command so you can avoid this! :: The use of DEBUG to extract data from lines is only :: needed under Win9x. if [%1]==[] goto HELP goto RUN :HELP cls echo You must supply a file name as an argument. goto DONE :RUN set created= dir %1 | find ":" | find "-" > ~created.bat > script echo f 100 l 1c 20 >> script echo e 110 "set created=" >> script echo rcx >> script echo 24 >> script echo w >> script echo q debug ~created.bat < script > nul del script call ~created.bat del ~created.bat echo Your file was created on %created% :DONE