Windows Server - Get tomorrows date by executing a bat file ?

Asked By silna chandra on 13-Jun-12 03:22 AM
Require Tomorrows date as part of output in YYYYMMDD format so that i can create a folder using MD command .
The code needs to be in MSDOS commands and not perl or php or any other vb script or power shell etc .. as i need to run the bat on windows server.
 please help
[)ia6l0 iii replied to silna chandra on 13-Jun-12 09:37 PM
Note that your short date format on the server should support yyyy. Otherwise, I don't see a way to retrieve the yyyy format. And also note that this was a script I used a while ago to create folders which were dumped with FTP files. Test this and adapt as required. 

@echo off

set /a day=%date:~0,2%
set /a mon=%date:~3,2%
set /a year=%date:~6,4%
set mon=0%mon%

   set /a day+=1

   if %day% gtr 31 (
      set day=1
      set /a mon+=1
      if %mon% gtr 12 (
         set mon=1
         set /a year+=1

xcopy /d:%mon%-%day%-%year% /h /l "%~f0" "%~f0\" >nul 2>&1 || goto loop
echo %year%%mon%%day%

md New_%year%%mon%%day%

Hope this helps.

silna chandra replied to [)ia6l0 iii on 14-Jun-12 12:06 AM
Thanks for your help ..let me test this script if it works for all dates (leap year , Y2K etc and then reply you )
silna chandra replied to [)ia6l0 iii on 14-Jun-12 12:23 AM
My date format is in long date format
so will this code work ?