Frag Infinity Tournament, Inc. - FITES LAN Party - www.fites.net

LAN Party Forums => Support Group => Started by: decepticon on October 13, 2009, 07:42:43 AM

Title: Script to change windows date....and more
Post by: decepticon on October 13, 2009, 07:42:43 AM
Does anyone know of a script or who can direct me to the info needed to make one that will change the Windows date back to one I specify when a specific program runs and then change it back to the normal date once the program exits?
Title: Re: Script to change windows date....and more
Post by: _!Rathe!_ on October 13, 2009, 08:09:00 AM
Depending on the program you are running you might be able to do it in a simple batch script.

Code: [Select]
date 10-03-2009
c:\program files\notepad.exe
date 10-13-2009

The batch script won't wait for every program to finish before executing the next statement.  That is why it won't work for any program.  Try it and see.
Title: Re: Script to change windows date....and more
Post by: decepticon on October 13, 2009, 08:14:32 AM
That worked, but I really need it to wait until the program exits and then change the date back to the current date.  I would have used a bat file, but I was under the impression that changing the date in a cmd window would not change the date for windows.  Now that I know that it works I will investigate the 'waiting' for a program to exit in a batch file.
Title: Re: Script to change windows date....and more
Post by: decepticon on October 13, 2009, 09:02:31 AM
Eureka!!!!

Code: [Select]
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET Today=%%B
date 6-03-2009
start /wait spw.exe
date %Today%
Title: Re: Script to change windows date....and more
Post by: _!Rathe!_ on October 13, 2009, 10:19:15 AM
DOS.  Still the most useful part of Windows.
Title: Re: Script to change windows date....and more
Post by: The Shoctor on October 13, 2009, 07:20:53 PM
It's not DOS, it's a CLI.
Title: Re: Script to change windows date....and more
Post by: sully! on October 14, 2009, 09:18:09 AM
It's not DOS, it's a CLI.

QFT!

Batch Scripts, VBScript, and PowerShell....every SysAdmin's three best friends. I really need to add PowerShell to my cache of "friends" but haven't gotten around to making introductions yet ;)