Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi I need to run a batch file which will move a file to a location while renaming it. I got the moving part but can't figure out how to get the date and 24 hour added to the file name.
Ok I found this code which is adding the date and time.
@ECHO OFF
for /f "tokens=2-4* delims=/ " %%a in ('DATE /T') do set THEDATE=%%c%%b%%aFor /F "tokens=2-4 delims=:" %%a in ('Command /C Echo. ^| Time ^| Find "current"') Do Set
THETIME=%%a%%b%%c
Set THETIME=%THETIME:~1%copy /Y/V C:\Temp\Batch\ORLREC.dat C:\Temp\Batch\ORLREC%THEDATE%%THETIME%.dat
copy /Y/V C:\Temp\Batch\Sorted3.csv C:\Temp\Batch\Sorted3%THEDATE%%THETIME%.csv
PAUSEBut the out put is like
ORLREC20080608114216.16.dat
Sorted320080608114216.16.csvSee the . before the 16. What do i need to change the code so that i don't get that?
I need the output to be
ORLREC20080608114216.dat
Sorted320080608114216.csv
Report Offensive Follow Up For Removal
![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |