# Solved: How to write a script to change date and time before starting a program



## rajaspoorna (Aug 19, 2009)

Hi guys,
I'm a total newb to scripting, so I wanted to know if it is possible to write a .bat file that does the following:
__________________________________________________________________________________________
Change system time to 3 o'clock
Change system date to 11 March 2011
Run program at J:\Softwares\Folder Z\Z.exe
__________________________________________________________________________________________
So, can you please help?
Thanks in advance,
Rajas


----------



## Techtatane (Feb 21, 2011)

Create a launch.bat file
edit launch.bat
@echo off
time 15:00
date 11/03/2011
J:\Softwares\Folder Z\Z.exe 






execute launch.bat as administrator
note that date format in this case is dd/mm/yy


----------



## rajaspoorna (Aug 19, 2009)

Thanks a lot!
But i forgot, is it possible to change the date and time to the real time after use?
I don't think it would. I think i might have to edit the program's exit code, and I don't know where that would be.


----------



## Techtatane (Feb 21, 2011)

You can try to synchronize with a time server :

create a *time.ba*t file and put this inside :

@echo off
w32tm /config /sychfromflags:manual /manualpeerlist:time.nist.gov
net stop w32time && net start w32time
w32tm /config /update
w32tm /resync /force

I tested this on win7 works fine.
But why do you need to change the execution time of your prog ?
What is the real deal about all this ?


----------



## rajaspoorna (Aug 19, 2009)

Thanks a lot buddy!
And to answer your question, I had bought a software called "Lipikaar", after trying the trial version, but the full version just doesn't work! It crashes as soon as the installation opens. I tried customer support, but they, for some reason say they don't know what is wrong. So i decided to use the trial version. I paid for it - if they can't get it to work, they can't give me a refund?


----------

