Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch File Programming: Date and Date Format

Status
Not open for further replies.

danhodges99

IS-IT--Management
Feb 6, 2003
21
GB
Hi all,

I'm after some help with getting output from what I assume would be the %DATE% and %TIME% variables and manipulating it.

Basically, I want to run a series of command and put it in a file with a timestamp as the file name, like this for example:

output.27Oct05.1606.txt

How would I get the date and time information in this format?

Thanks in advance :)
 
Here's how a wiz here did it....

-=-=-=-=-=
for /f "tokens=2,3,4 delims=// " %%i in ('date/t') do set pdate=%%i%%j%%k
move C:\Image\*.log I:\Log%pdate%.log
-=-=-=-=-=

I've written a lot of batch files, and understand programming, but can't bring myself to understand what that for statement is doing. I just know it works.

Good luck--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top