Skip to content.

TalkBMC

Sections
You are here: Home » Blog Archive » Anne Gentle » Exploring Information Design and Development » MS-DOS tipes for time and date stamps

Comment

Above in this comment thread: MS-DOS tips for time and date stamps » MS-DOS Tips for Time and Date Stamps

MS-DOS tipes for time and date stamps

Posted by Joe Randle at 2006-06-06 12:22
Anne:

Thanks for your timely response, but I have since figured it out and it works fine now.

I use it to RENAME an existing file uploaded from a bar code scanner to the required date time string for a vendor script to pick it up and process it. Below is the portion of the MS DOS batch regarding the renaming. Also works well for creating and naming a folder with a little tweaking. It is a pretty handy little function and I doubtlessly will find other uses for it. I am going back later to enter some REM lines for clarity.

set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set NewName=DATA-%date:~-4,4%%date:~-10,2%%date:~-7,2%-%HH%%time:~-8,2%%time:~-5,2%
ren dtfile1.txt %NewName%.txt
 
 

Powered by Plone

This site conforms to the following standards: