Author Options:

Can I get some help creating a batch file that continuously changes my time 1 hour ahead? Answered

So I have a game that operates in real time and it is synced with my clock, I benefit great amounts of time by setting it forward (it takes about 15 seconds to wait while the game catches up and re syncs - in essence, a fastforward button).

I need help making a batch file(or .vbs) that changes the clock 1 hour ahead, waits 15 seconds, then does it again in a continuously loop; until I end the batch process of course. Any help?



7 years ago

I'm afraid I don't think there is any good way to do this in pure batch. However with the help of an external program, this is a piece of cake!

I have written a program for you that allows you to increase the system time by any amount of minutes you'd like. The syntax for the program is really simple, in a batch file you simply time "AdvanceTime 60 -s". 60 can be changed with any number, that number will be added to the system time. -s actives the program silent mode (The program won't give any output). When you have that program stored in the same folder as your batch file, just add that to a loop!

I've written the batch file for you too, so it does exactly what you asked for. Grab the package in the attachment (Be sure to virus scan any exe file before running!).

The source is included for those of you who'd like to see how it works under a GPL license.


I tried it out, no luck. I'm using Windows 7 and it gives me the error:

"sleep is not recognized as an internal or external command".

Activating the batch or .exe doesn't do anything but displays a cmd window for a split second.

Any help? Is it my windows version?

I have ran this ad admin as well and no dice.

Ah, yes, it's your windows version that's the problem. Sleep is not longer a part of the system and has been relapsed by the timeout function. If you open the TimeLoop.bat batch file in notepad and replace "sleep 15" with "timeout /t 15" it should work.

Double -clicking the exe should open and close a command prompt immediately, because it is meant to be run from an already open command prompt. This is standard behavior for any cmd exe file. If you want to run such a file, you should create a new batch file and type


Tell me if the program works for you now!

No luck,

AdvanceTime still doesn't do anything to my system time so I'd imagine that's the reason the .bat does nothing either.

This is what is displayed in the cmd prompt:

Sleeping for 15 seconds
The system cannot find the path specified.
1 hour added to system time!
(your license info)
Advancing system time by 60 minutes.
An error occurred

Thanks for your help.

That certainty is strange. Did you change the batch file a lot? The output isn't what I'd expect it to be (I don't recall something that would not find the specified path). Could you post the batch file?

Also, did you run the program as administrator? AdvanceTime requires administrator privileges in order to set the system time.

I ran the batch file from command prompt as admin.

Here is the batch file, all i did was change the sleep to timeout as directed:

echo off
echo TimeLoop.bat - Calls "AdvanceTime" to advance
echo the system clock by 60 minutes every 15 seconds.
echo AdvanceTime.exe - Lets you set you advance your
echo system clock by x minutes.
echo Both programs are written by Wkter, (C) 2010

rem We call the AdvanceTime in silent mode so that
rem we can print our own output instead

set var=0

echo %var%: 1 hour added to system time!
AdvanceTime 60
echo %var%: Sleeping for 15 seconds
set /a var+=1
timeout /t 15
goto Loop

Running the advancetime.exe from the root directory says this:
(program info/copyright)
Advancing system time by 60 minutes.
An error occurred

Running timeloop.bat says this:

Waiting X seconds (it counts down from 15, thanks), press any key to continue
1 hour added to system time!
(program info/copyright)
Advancing system time by 60 minutes.
An error occurred

for some reason, advancetime still does nothing to my....

Oh snap. I wasn't running command prompt in admin mode >.<. Thanks a bunch for everything!

So I suppose it's working now?
Glad I could help!

Remember you can write "AdvanceTime 60 -s" to turn off my self-promotion XD

It does work, thanks a ton. I've already zipped and begun distribution to other players along with a short readme and credits to the creator.

I always give credit where credit is due, maybe it's my college education plagarism speeches sinking in.