batch file

Hello, can I get some help please?
can someone show me a a script for a batch file that gets the current time/date and changes it by one day ahead.
So if the computer's current time is May 15 2015 11:59pm, i need a script that will change that to May 16 2015 1:01am.
And the next day it runs again and it changes it to May 17 2015 1:01am.    The reason why I'm doing this is cause I have a very old program that is custom build and for some strange reason it always freezes at midnight. Some sort of task/job is trying to run at midnight so I'm trying to skip 12:00am.  
thanks for your help.
MrMayAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SStoryCommented:
someone has already written a script to get tomorrow's date from a batch file:
http://www.experts-exchange.com/articles/4196/Advanced-Batch-File-Programming-TOMORROW-BAT.html

You could modify it. Instead of:
xcopy /d:%m%-%d%-%y% /l . .. >nul 2>&1 || goto loop

You could do something like:

date  %m%-%d%-%y%
time 01:01:00

Have this run by a Windows job at 11:59pm every day.
Bill PrewIT / Software Engineering ConsultantCommented:
Yes, we could fashion a script like this, not easy in basic DOS BAT script, but VBscript or PowerSheel should be able to handle.  However, there are a few details I'd like to understand better.

You want to run the script just before midnight, and advance the clock by 62 minutes (in your example the clock would change from May 15 2015 11:59pm, to May 16 2015 1:01am).  This seems a little odd, why not just by 2 minutes to "jump over midnight itself?

Also, naturally doing this everyday will slowly result in the time on the compute being more and more inaccurate, isn't that a problem?  Do you also plan to do the opposite, set the clock back the same amount of time at some point the next day?

Does the DOS program need to be running at midnight?  Could another potentially safer approach be to end the DOS program just before midnight, and then restart it just after midnight?

~bp
MrMayAuthor Commented:
Hi BillPrew... My mistake... I meant to type 12:01am... I need it to jump 12:00am...  (for from 11:59pm to 12:01am) I can't restarts the dos program. Its constantly being used.
Its fine if the time is offset... not important in this production system.
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

SStoryCommented:
Of course power shell and other languages are easier.  A programming language like vb.net or c# or whatever would also be easier than a batch file...super simple, but you'd have to know vb.net and compile it.

What I wrote would do what you asked. Just change the line
time 01:01:00
to
time 12:01:00
Bill PrewIT / Software Engineering ConsultantCommented:
Okay, here's a small BAT file that should do the job, give it a test.

@echo off

REM Create small VBS script to return tomorrows date
echo.Wscript.Echo Date()+1>_t.vbs

REM Run VBS script, get tomorrows date, set date time to tomorrow at 12:01 am
for /F "delims=*" %%A in ('cscript //nologo _t.vbs') do (
  date %%~A
  time 00:01:00
)

REM Remove temporary VBS
del _t.vbs

Open in new window

~bp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SStoryCommented:
OK. I make no warranties whatsoever, but the following vb.net program, should work if ran at 11:59:00. Just unzip it and schedule it to run.  Dotnet 2.0 should be installed on the machine. All win 7 machines have that by default.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.