Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Time on Computer with VBScript

Computer Settings

Change Time on Computer with VBScript

by  alistairpaul  Posted    (Edited  )
Set fileSys = CreateObject("Scripting.FileSystemObject")
Set fileOut = fileSys.CreateTextFile("D:\dotime.bat", True)
fileOut.WriteLine "time %1"
fileOut.Close

Set wShell = CreateObject("WScript.Shell")
timetoset = "09:00:00"
run_this = "dotime.bat " & timetoset
wShell.Run run_this, 1, TRUE

Set fil = fileSys.GetFile("D:\dotime.bat")
fil.Delete

Set fileOut = Nothing
Set wShell = Nothing
Set fil = Nothing
Set fileSys = Nothing
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top