Compare Current Date To A Specific Date
Posted: 22 Mar 2018 10:42
Hello,
We use batch files to start MS Access databases. The batch files are stored in a network folder and copy the front-end user interface database file to the user's computer. We are in the process of converting the MS Access user interface databases to C# applications. I have one application that the administrator wants the transition to occur on May 1, 2018.
How would I compare the current date to May 1, 2018 in a batch file? If the current date is before (less than) May 1, 2018, I want to start the MS Access database. If the current date is on or after (greater than or equal) May 1, 2018, I want to start the C# application.
We use batch files to start MS Access databases. The batch files are stored in a network folder and copy the front-end user interface database file to the user's computer. We are in the process of converting the MS Access user interface databases to C# applications. I have one application that the administrator wants the transition to occur on May 1, 2018.
How would I compare the current date to May 1, 2018 in a batch file? If the current date is before (less than) May 1, 2018, I want to start the MS Access database. If the current date is on or after (greater than or equal) May 1, 2018, I want to start the C# application.
Code: Select all
echo off
REM -----
REM modified Ideal ANMI Start-Up Batch for 2007 - can't share due to no D: drive.
REM -----
set appid=eBN
:BEGIN
:: Compare current date to May 1, 2018
:: If current date geq May 1, 2018, goto CSharp
:WIN2007
set appos=WIN2007
if exist "%USERPROFILE%\Desktop\Shortcut to eBN Generator" del "%USERPROFILE%\Desktop\Shortcut to eBN Generator"
if not exist "%USERPROFILE%\Desktop\eBN Generator.lnk" copy "\\snt206\Repository\ICN2007\eBN Generator.lnk" "%USERPROFILE%\Desktop\eBN Generator.lnk"
if not exist "%USERPROFILE%\apps\%appid%" mkdir "%USERPROFILE%\apps\%appid%"
copy \\snt207\Repository\ICN2007\Install\eBNUser.mde %USERPROFILE%\apps\%appid%\eBNUser.mde >nul
copy "\\snt207\Repository\ICN2007\Install\Cover Sheet.rtf" "%USERPROFILE%\apps\%appid%\Cover Sheet.rtf" >nul
start /MAX msaccess.exe %USERPROFILE%\apps\%appid%\eBNUser.mde
:CSharp
:DONE