|
|
Question : AT command time = remote machine current time
|
|
This may be a bit of a toughy.. I was wondering how it would be possible to run an AT with them current time of the remote machine +1min?
AT \\remote-machine time+1min c:\task
Thanks
|
Answer : AT command time = remote machine current time
|
|
If you wanted to, you could use a couple "FOR /F" loops to filter the current time of the remote into variables without changing local time. Tested on 2K, highly suspect XP works too:
Enjoy,
2K (\o/)
::innuhminnittatt.cmd @echo off SETLOCAL :: set remote machine and command SET RPC=\\Remote_PC_name SET Rcmd=net send %USERNAME% test from %~n0 :: Set number of minutes to wait per remote time SET WaitTime=1 :: NOTES: Remote clock might only be one second from the next minute, :: Adding 1440 minutes or less should work until 11:59PM, as I :: have not adjusted for "Day after tomorrow"
:: Pull time and noon indicator from remote and separate with colon for /F "tokens=7,8" %%K in ('net time %RPC%') do set RemoteNow=%%K:%%L :: set hour and minute of remote for /F "usebackq tokens=1,2,3 delims=:" %%K in (`echo %RemoteNow%`) do ( set Rhour=%%K set Rmin=%%L IF %%M==PM set /a Rhour=%%K + 12 IF %%K%%M==12PM set /a Rhour=%%K ) echo Current RPC time: %Rhour%:%Rmin% :: Add a the wait time whatever you need: set /A Rmin=%Rmin% + %WaitTime% :: Adjust time if invalid - AT is a bit picky :checkmin If %Rmin% LSS 60 goto :checkhr SET /A Rmin=%Rmin% - 60 SET /A Rhour=%Rhour% +1 goto :checkmin :checkhr If %Rhour% LSS 24 goto :checkdone SET /A Rhour=%Rhour% -24 If %Rhour% LSS 24 goto :checkdone echo ERROR: Script not smart enough to run things two days or more into the future goto :END :checkdone echo Time to run command: %Rhour%:%Rmin%
:: enough chatter, already - - Do it. AT %RPC% %Rhour%:%Rmin% "%Rcmd%"
::display jobs at remote AT %RPC%
:END
|
|
|
|
|