Thursday, January 9, 2014

WshShell | Code to change System Date

You might want to change the windows system Date/Time during a script runtime, below is the code for the same.

Var_Date="01.09.2014"
Dim WS
Set WS= CreateObject("WScript.Shell")
WS.run "cmd"
window("object class:=ConsoleWindowClass").Type "date " & Var_Date
window("object class:=ConsoleWindowClass").Type chr(13)
window("object class:=ConsoleWindowClass").Type "exit"
window("object class:=ConsoleWindowClass").Type chr(13)
Set WS= nothing

No comments:

Post a Comment