70470 Posts in 6879 Topics - by 687 Members - Latest Member: Laricwashere

Author Topic: Script to change windows date....and more  (Read 1372 times)

Offline decepticon

  • Staff
  • Godlike Gamer
  • *
  • Posts: 5763
  • Karma: 6
  • aka "Deception"
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 3.5.3 Firefox 3.5.3
  • Steam ID: seanryan52
  • XBox Gamer Tag: Decpticon
  • XFire: decepticon420
Script to change windows date....and more
« 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?
That's Mr. Deception to you.

Offline _!Rathe!_

  • Master Sergeant Shooter Sergeant Person
  • Godlike Gamer
  • *
  • Posts: 2296
  • Karma: 0
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 3.5.3 Firefox 3.5.3
  • XFire: rathewin2k
Re: Script to change windows date....and more
« Reply #1 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.
Never, but never question the engineers judgement.

Offline decepticon

  • Staff
  • Godlike Gamer
  • *
  • Posts: 5763
  • Karma: 6
  • aka "Deception"
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 3.5.3 Firefox 3.5.3
  • Steam ID: seanryan52
  • XBox Gamer Tag: Decpticon
  • XFire: decepticon420
Re: Script to change windows date....and more
« Reply #2 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.
That's Mr. Deception to you.

Offline decepticon

  • Staff
  • Godlike Gamer
  • *
  • Posts: 5763
  • Karma: 6
  • aka "Deception"
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 3.5.3 Firefox 3.5.3
  • Steam ID: seanryan52
  • XBox Gamer Tag: Decpticon
  • XFire: decepticon420
Re: Script to change windows date....and more
« Reply #3 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%
That's Mr. Deception to you.

Offline _!Rathe!_

  • Master Sergeant Shooter Sergeant Person
  • Godlike Gamer
  • *
  • Posts: 2296
  • Karma: 0
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 3.5.3 Firefox 3.5.3
  • XFire: rathewin2k
Re: Script to change windows date....and more
« Reply #4 on: October 13, 2009, 10:19:15 AM »
DOS.  Still the most useful part of Windows.
Never, but never question the engineers judgement.

Offline The Shoctor

  • Administrator
  • Godlike Gamer
  • *
  • Posts: 5803
  • Karma: 17
  • OS:
  • Windows 7 Windows 7
  • Browser:
  • Firefox 3.5.3 Firefox 3.5.3
  • Steam ID: shadohawk@shadoworks.net
  • XBox Gamer Tag: TheShoctor
  • XFire: shadoworks
Re: Script to change windows date....and more
« Reply #5 on: October 13, 2009, 07:20:53 PM »
It's not DOS, it's a CLI.

Support LAN Play!
ლ(ಠ益ಠლ) "I have more than 20 friends EA!" --FITES.NET
(╯°□°)╯︵ ┻━┻
"Close enough." --UGC League

Offline sully!

  • Administrator
  • Godlike Gamer
  • *
  • Posts: 4997
  • Karma: 16
  • If the future is now, where's my jetpack?
  • OS:
  • Windows 7 Windows 7
  • Browser:
  • Minefield 3.7a1pre Minefield 3.7a1pre
  • Steam ID: sully213
  • XBox Gamer Tag: FITESully
Re: Script to change windows date....and more
« Reply #6 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 ;)
Please just walk away. I don't want to have to stand here and say something so awesome that I'll have to remember it the rest of the day. Thank you!