Jump to content
Sign in to follow this  

[SOLVED] [] Change system date?

Recommended Posts



I need to use an old application that is no longer sold and only a 30-day trial version is available.

As a work-around, I'd like to change the system date 10 days in the past, run the application, and set the system date back to today.

I found this code which only changes the year, but setting the date back 10 days is more tricky:

$date = @MON & "/" & @MDAY & "/" & @YEAR
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\DateChange", "Date", "REG_SZ", $date)
RunWait(@ComSpec & " /c " & "date " & @MON & "/" & @MDAY & "/" & @YEAR-1, "", @SW_HIDE)

$date = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\DateChange", "Date")
RunWait(@ComSpec & " /c " & "date " & $date, "", @SW_HIDE)

Does someone have some working code I could use for this by any chance?

Thank you.

Edited by littlebigman

Share this post

Link to post
Share on other sites

For those looking for the same thing:

#include <Date.au3>

$Date = _DateAdd("d",-10,_NowCalcDate())
$DateArray = StringSplit($Date,"/")
$FormattedDate = $DateArray[2] & "-" & $DateArray[3] & "-" & $DateArray[1]
msgbox(0, $FormattedDate, $FormattedDate)

Incidently, mentions two applications that do exactly what I needed:



I couldn't get TimeStopper to pass a parameter to the application, while RunAsDate works fine.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.