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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOS BATCH SCRIPTING 1

Status
Not open for further replies.

muralisai25

IS-IT--Management
Jul 20, 2002
51
US
Hi All,
Does anyone have a sample plain MS DOS script to display date in mm-dd-yyyy or mm-dd-yy format. When i do a Date /T in the dos window i get the current date in the followong format Fri 05/14/2004 but i would like display it as 05-14-2004 or 05-14-04. Please advise.
Thanks
 
Try this:
Code:
for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%%j-%%k-%%l
echo %dt%
 
hi Corbin,
I copied your statement in a batchfile and added a pause at the end to see the results. All i get is the Year 2004.
I do not see 05-14-2004 or 05-14-04
Please advise
 
Hi crobin,
I think i got this right. Thanks a bunch for your help
Sai
 
Hi,
I have another dilemma, is there a way I can get to display yesterday's date instead of current date?? PLease help
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top