JSI Tip 10443. How can I generate a time that is 2 minutes in the future and is suitable for using with the AT command?

John Savill

April 26, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today

I have scripted AT2.bat to generate a time that is 2 minutes in the future, and is suitable for using with the AT command.

NOTE: If you install Soon.exe, the near-future command scheduler, you don't need this tip.

The syntax for using AT2.bat is:

[call] AT2 TPlusTwo

Where TPlusTwo is a call directed environment variable that will contain a time, that istwo minutes in the future, and suitable for using with the AT command.

AT2.bat contains:

@echo offif {%1}=={} @echo Syntax: AT2 Time&goto :EOFsetlocalset vb="%TEMP%AT2_%RANDOM%.vbs"@echo.Wscript.Echo DateAdd("n", "2", (now))>%vb%for /f "Tokens=1*" %%a in ('cscript //nologo %vb%') do ( set tm=%%b)set tm=%tm: =%del /q %vb%endlocal&set %1=%tm%



About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like