Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Is there any way to get the %time% variable to display as 1340 for example, rather than 13:40:24?
Here is basically what I'm trying to do:
The goal is to copy a file, in this case AppEvent.evt, to a directory every 4 hours. Simple enough with a scheduled copy command batch file or script. The catch here is that the target file needs to have a sequential number or time stamp appended to it's name. This way we don't overwrite the file every 4 hours, but have a bunch of files labeled AppEvent01.evt, AppEvent02.evt, etc.
I'd like to do this task without a 3rd party app. If I can just append the time and date to the end of a file in the correct file format, that would be great.
Thanks for your time.

Hi DomC,
With w2k cmd.exe extensions enabled, you can use the 'tokens.'
I haven't got the hang of it yet. But there are many examples here.
Like you, I like to avoid 3rd party utils.
I wrote a bat which we used to back up a POS, which did an 'if exist' and incremented the letter suffix. A little klunky, be works. You are welcome to a copy.
You could use the w2k built in %random% which id 5 digits and unlikely to cause a name collision any time soon.
If it's mission critical, put in an 'if exist' and get a fresh random number.

![]() |
![]() |
![]() |

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