littlebigman Posted March 23, 2011 Share Posted March 23, 2011 (edited) Hello 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 March 23, 2011 by littlebigman Link to comment Share on other sites More sharing options...
littlebigman Posted March 23, 2011 Author Share Posted March 23, 2011 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:http://www.nirsoft.net/utils/run_as_date.htmlhttp://timestopper.blinkweb.com/I couldn't get TimeStopper to pass a parameter to the application, while RunAsDate works fine.HTH, Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now