![]() |
![]() |
|
|
Hi I have a batch file that renames a file and appends the time on the end of the filename. What I need it to do is append both the |
![]() |
|
|
#1 | ||
|
Guest
Posts: n/a
|
Hi
I have a batch file that renames a file and appends the time on the end of the filename. What I need it to do is append both the time and date at the same time. My line of code is: for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename "filename.xls" "filename"%%d-%%e-%%f.xls I'm sure i can do this in one line but not sure how to add the %date% in correctly Any help appreciated Thanks |
||
|
|
|
#2 | ||
|
Guest
Posts: n/a
|
<alexanderd79@googlemail.com> wrote in message news:ca05d8ad-d2ab-4099-b622-87eb61ac9c49@e23g2000prf.googlegroups.com... > Hi > > I have a batch file that renames a file and appends the time on the > end of the filename. What I need it to do is append both the time and > date at the same time. My line of code is: > > for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename > "filename.xls" "filename"%%d-%%e-%%f.xls > > I'm sure i can do this in one line but not sure how to add the %date% > in correctly > > Any help appreciated > > Thanks Perhaps something like this: for /F "tokens=1-8 delims=:/" %%a in ('echo %date% %time%') do echo ren "file.xls" "%%a-%%b-%%c %%d-%%e file.xls" |
||
|
| Sponsored Links |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|