:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:Timer ID
::
:: By: Ritchie Lawrence, 2002-10-10. Version 1.0
::
:: Func: Returns number of seconds elapsed since the function was last
:: called and first called. For NT4/2000/XP/2003.
::
:: Args: %1 (by ref) The first time this function is called, this variable
:: is initialised to '<last> <first> <init>' where <last> and <first>
:: are zero and <init> is the number of elapsed seconds since
:: 1970-01-01 00:00:00. This value is used by subsequent calls to
:: determine the elapsed number of seconds since the last call
:: (<last>) and the first call (<first>).
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS&call set ID=%%%1%%
set t=2&if "%date%z" LSS "A" set t=1
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo/^|date') do (
for /f "tokens=%t%-4 delims=.-/ " %%d in ('date/t') do (
set %%a=%%d&set %%b=%%e&set %%c=%%f))
for /f "tokens=5-7 delims=:. " %%a in ('echo/^|time') do (
set hh=%%a&set nn=%%b&set ss=%%c)
set /a dd=100%dd%%%100,mm=100%mm%%%100
set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2
set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633
set /a hh=100%hh%%%100,nn=100%nn%%%100,ss=100%ss%%%100
set /a j=j*86400+hh*3600+nn*60+ss
for /f "tokens=1-3 delims= " %%a in ('echo/%ID%') do (
set l=%%a&set f=%%b&set c=%%c)
if {%c%}=={} endlocal&set %1=0 0 %j%&goto :EOF
set /a l=j-c-l,f+=l
endlocal&set %1=%l% %f% %c%&goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Simplemente, hermoso.
Aunque if {%c%}=={} tambien usaría if not defined.
antrax se puede programar el bath para que se ejecute en cieta fecha del mes?
Si asi es, busca informacion sobre el comando AT en batch
muchas gracias lo necesito para reiniciar un servidor que tengo a 100 km de mi ciudad y el que lo administra me llame para "arreglarlo" es como para evitar robos -.-