Change the system date
Posted: 09 Jan 2020 10:23
Hi,
My windows version is 10.1.18362
I need to change the system date, run a program then change the date back again. The following works fine but requires to be run as admistrator and won't give me the right date tomorrow.
date 01-03-07
filename.exe
pause
date 05-01-20
The next loads beforedate with 05-Jan-19 and sets the date to 01-04-09. "date %BEFOREDATE%" returns "The system cannot accept the date entered. Enter the new date (dd-mm-yy). I guess it doesn't like "Jan"
set BEFOREDATE=%date:~%
date 01-04-09
filename.exe
pause
date %BEFOREDATE%
I also need to run this without administraror.
Any help greatly appreciated.
My windows version is 10.1.18362
I need to change the system date, run a program then change the date back again. The following works fine but requires to be run as admistrator and won't give me the right date tomorrow.
date 01-03-07
filename.exe
pause
date 05-01-20
The next loads beforedate with 05-Jan-19 and sets the date to 01-04-09. "date %BEFOREDATE%" returns "The system cannot accept the date entered. Enter the new date (dd-mm-yy). I guess it doesn't like "Jan"
set BEFOREDATE=%date:~%
date 01-04-09
filename.exe
pause
date %BEFOREDATE%
I also need to run this without administraror.
Any help greatly appreciated.