Logo Background

Sysdate-1 DOS Batch Command

  • By on March 27, 2009 | 1 Comment

    To echo sysdate-1 output from DOS batch file was not straight forward as we can do in UNIX Shell Script.

    First, as we know that we can output today date as echo %date% or echo %sysdate% in DOS command prompt.

    However, getting the yesterday date was not simple. You need a series of date formatting command in DOS prompt.

    You can copy and paste the following command in your batch files which will output yesterday date.

    @echo off
    set dates=%date:~7,2%
    set /A day  =%dates% - 1
    set /A month=%date:~4,2%
    set /A year =%date:~10,4%
    echo %day%/%month%/%year%
    Previous
    Next
    » Add/Register Shell Script In Oracle Applications
  1. #1 Arjun Singh Chauhan
    November 12, 2011 4:51 am

    REM – Create Date and Time strings
    set Today=%date:~6,4%%date:~0,2%%date:~3,2%
    d:
    cd d:\
    xcopy 123 %Today% /c /y /h /r /t /e /i/x
    attrib -h %Today%

    Post ReplyPost Reply
Leave a Comment