Question : DOS Bat File Copy a File with Date Timestamp

I have a bat file below

copy S:\Apps\EAM\PDCApptLtr\Prod\Appointment_Combined.csv S:\Apps\EAM\PDCApptLtr\Prod\Appointment_Combined_%date:~4,2%%date:~7,2%%date:~12,2%%time:~0,2%%time:~3,2%%time:~6,2%.csv

Should copy the file in the same directory so that it looks like this
Appointment_Combined_072210153051.csv
It now copies nothing.  Any ideas on syntax?  Thanks

Answer : DOS Bat File Copy a File with Date Timestamp

It is a zero padding issue. To address it you can use the following code. This is where I got the solution:

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_23178549.html

sew
1:
2:
3:
4:
@echo off
set hour=%time:~0,2%
if "%hour:~0,1%"==" " set hour=0%hour:~1,1%
copy S:\Apps\EAM\PDCApptLtr\Prod\Appointment_Combined.csv S:\Apps\EAM\PDCApptLtr\Prod\Appointment_Combined_%date:~4,2%%date:~7,2%%date:~12,2%%hour%%time:~3,2%%time:~6,2%.csv
Random Solutions  
 
programming4us programming4us