Page 1 of 1

Restart machine on every friday arount 12:00PM

Posted: 08 Aug 2011 01:33
by kumar_kondapalli
Hi Every one ,

Can any one please post a .bat file which restarts machine on every friday around 9:00PM

Thanks,
Santosh kumar

Re: Restart machine on every friday arount 12:00PM

Posted: 08 Aug 2011 13:04
by !k

Code: Select all

setlocal enableextensions
set "dayX=Fr" &set "hourX=21"
:day
>today.vbs echo.WScript.Echo WeekDayName(Weekday(Now),True)
for /f %%a in ('cscript /nologo today.vbs') do set "today=%%a"
if not "%today%"=="%dayX%" (ping -n 3333 localhost >nul &goto :day)
set /p last=< lastdate.log
if "%date%"=="%last%" (ping -n 99999 localhost >nul &goto :day)
:hour
if not "%time:~-0,2%"=="%hourX%" (ping -n 333 localhost >nul &goto :hour)
echo %date%> lastdate.log
shutdown -r

Re: Restart machine on every friday arount 12:00PM

Posted: 08 Aug 2011 14:17
by Ed Dyreen
'

Code: Select all

set "?=1sthMonth.CMD"    &set /p "?=  :/ !?!    "<nul
::(
   at 00:00 /interactive /every:1 "!FullPath.SOURCE!\!?!"
::)

set "?=Saturday.CMD"    &set /p "?=  :/ !?!    "<nul
::(
   at 00:00 /interactive /every:za "!FullPath.SOURCE!\!?!"
::)

Re: Restart machine on every friday arount 12:00PM

Posted: 09 Aug 2011 00:07
by kumar_kondapalli
Hi The first code works perfectly :-).

I have not tested Edward code . but i think it will work.


Thanks a lot for your help guys ..


Thanks,
San

Re: Restart machine on every friday arount 12:00PM

Posted: 09 Aug 2011 05:10
by kumar_kondapalli
HI FOlks,

Adding one more query. Can the bat file run automatically on every friday around 13:00pm to shut down the machine.



Note: I know we can call the bat file from a scheduler in the control panel a part from that ..

Awaiting for your reply.

Thanks,
San