Page 1 of 1

My Time Issue

Posted: 03 Sep 2009 18:40
by Hunterwould
Alrighty, I want this batch file to be automatic. the problem code is:

Code: Select all

 set timewanted=%time%+1 

where the plus one stands for one minute I want to add...
I need this so that later it can do

Code: Select all

 at %timewanted% /interactive (commands) 

Posted: 03 Sep 2009 19:18
by avery_larry

Code: Select all

@echo off
for /f "tokens=1-4 delims=:. " %%a in ("%time%") do (
   set "hr=%%a"
   set /a min=100%%b %% 100 +1
   set "sec=%%c"
   set "dec=%%d"
)
set "min=0%min%"
if %min%==060 (
   set "min=00"
   set /a hr=100%hr% %% 100 +1
)
set "hr=%hr%
if /i "%hr%"=="24" set "hr=0"
::Not sure the format of time that "at" wants so you'll
::have to figure it out.
set "timewanted=%hr%:%min:~-2%:%sec%.%dec%"
set "timewanted=%hr%:%min:~-2%:%sec%"
echo.%timewanted%

Posted: 03 Sep 2009 19:32
by Hunterwould
Thank you This was a major help in automation
:D

Posted: 04 Sep 2009 08:25
by avery_larry
I'm not sure what you're trying to do -- but you could just add a 1 minute delay in your script like this:


ping -n 61 -w 800 127.0.0.1 >nul 2>nul


Might be easier/better than using "at" . . .

Posted: 08 Sep 2009 19:00
by Hunterwould
Well I Was Gonna do that but I needed to learn how to get variables anyhow so it doesn't matter the batch is made. :wink: