MSFN Forum: I need some help with a looping CMD/BAT - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

I need some help with a looping CMD/BAT looping shutdown? Rate Topic: -----

#1 User is offline   ripigs 

  • Newbie
  • Group: Members
  • Posts: 35
  • Joined: 05-January 08

Posted 21 January 2008 - 02:32 AM

I am trying to loop shutdown so the user does not shutdown/restart the computer during the install process, then I need it to stop the shutdown loop after the CMD/BAT is done doing what I want it to do.


@echo off
:loop
shutdown -a
ping 127.0.0.1 -n 00 >nul
goto :loop

+++++++++
Then all my other CMD's
after that
+++++++++

Just need some help!!


#2 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 8,792
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 21 January 2008 - 03:42 AM

What I would do in the batch:
1) Issue a shutdown.exe -a
2) Rename shutdown.exe to shutdown.NOP (or whatever)
3) Execute rest of the batch
4) Rename shutdown.NOP back to shutdown.exe

jaclaz

#3 User is offline   ripigs 

  • Newbie
  • Group: Members
  • Posts: 35
  • Joined: 05-January 08

Posted 23 January 2008 - 09:09 PM

Thanks, I gave it a try but windows just put shutdown back into the system32 folder.
But just placing the===shutdown -a ===should do the job.

#4 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,118
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 23 January 2008 - 11:48 PM

My understanding is that `shutdown -a` will abort a running shutdown procedure. It appears that you are wanting to prevent one from being issued, which is not the same. I would doubt that having a looping abort switch would be an efficient method of stopping a new shutdown procedure from being invoked. Apart from that the commands at the bottom of your batch file will never get issued since the loop will never end. You could to look at opening another console session using a defined windows title which runs the loop, running your commands in the original session ending with a command to close the looping batch using its windows title.

You may be able, as jaclaz already suggested, to simply rename shutdown.exe, (after preventing WFP from `fixing` it) but to be honest there's nothing to stop users from pushing the button on the front of the PC anyhow.

Also you say install process, what are you installing, it sounds as if you are trying to install something unattendedly for other users which must take some time and over which you'd like to have more control.

My suggestion, whether you like it or not, is to have a little faith in your end users, pop up a message letting them know of the install procedure and that switching off will likely render their computer useless.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy