Just copy and paste the text in quotes to a text file. Then rename file test.bat and run from command line to see (echo is on by default).
This can be used in a very powerful way, the FOR command can be reused and changed to query to see if a file exists and then if so create the folder, etc.
for now, lets start basic…
Code:
echo on
@REM Seamonkey’s quick date batch (MMDDYYYY format)
@REM Setups %date variable
@REM First parses month, day, and year into mm , dd, yyyy formats and then combines to be MMDDYYYY
FOR /F “TOKENS=1* DELIMS= ” %%A IN (’DATE/T’) DO SET CDATE=%%B
FOR /F “TOKENS=1,2 eol=/ DELIMS=/ ” %%A IN (’DATE/T’) DO SET mm=%%B
FOR /F “TOKENS=1,2 DELIMS=/ eol=/” %%A IN (’echo %CDATE%’) DO SET dd=%%B
FOR /F “TOKENS=2,3 DELIMS=/ ” %%A IN (’echo %CDATE%’) DO SET yyyy=%%B
SET date=%mm%%dd%%yyyy%
this does nothing but setup the %date variable to be todays date in MMDDYYYY format so it can be called later in the script, etc..
Bookmarks