Restart machine on every friday arount 12:00PM

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
kumar_kondapalli
Posts: 32
Joined: 08 Jul 2011 03:38

Restart machine on every friday arount 12:00PM

#1 Post by kumar_kondapalli » 08 Aug 2011 01:33

Hi Every one ,

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

Thanks,
Santosh kumar

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

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

#2 Post by !k » 08 Aug 2011 13:04

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

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

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

#3 Post by Ed Dyreen » 08 Aug 2011 14:17

'

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!\!?!"
::)

kumar_kondapalli
Posts: 32
Joined: 08 Jul 2011 03:38

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

#4 Post by kumar_kondapalli » 09 Aug 2011 00:07

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

kumar_kondapalli
Posts: 32
Joined: 08 Jul 2011 03:38

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

#5 Post by kumar_kondapalli » 09 Aug 2011 05:10

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

Post Reply