pthomass Posted June 20, 2005 Report Share Posted June 20, 2005 Hi,I'm trying to do a shutdown over my network. I can logon to the device(s) with NET USE \\computername /user:administrator passwordand I can shut them down with SHUTDOWN -s -m \\computername -t 60 -c "Your computer will shutdown in:"But now I want to put them in a bat file. But I cannot seem to get that to work. The NET USE thingy works. But for the shutdown it gets stuck into a loop of some sort.Anyone an idea? Quote Link to comment Share on other sites More sharing options...
scuzzman Posted June 20, 2005 Report Share Posted June 20, 2005 What's happening is the "shutdown" program is never exiting and is thus halting all other execution until it's finished (the nature of a single-tasking OS). You might try invoking a secondary Batch file with the shutdown command in it after the net use command. I'm trying to find how to background a process in batch (similar to the & in *NIX scripts) but my searches are not too promising... Quote Link to comment Share on other sites More sharing options...
pthomass Posted June 21, 2005 Author Report Share Posted June 21, 2005 But why is it then,when I open the DOS window and type shutdown -s -m \\computername -t 60 -c "Computer will shutdown"it will excecute only once? I can see on the computer that I want to shutdown that there comes a window that sais that the system will shutdown and that you need to save your work. And you see a timer running.But, when I put the same line in a bat file and run the bat file, the other computer doesn't respond. The window doesn't appear and in my DOS window the commandline keeps appearing over and over again. I need to type CTRL+C to shut it down.I really don't understand why in DOS it works, and the some command doesn't work when in a .bat file Quote Link to comment Share on other sites More sharing options...
scuzzman Posted June 21, 2005 Report Share Posted June 21, 2005 Does it also return you to a C:\> (or whatever) prompt?If so, then the program is successfully exiting. Otherwise, it isn't exiting. Quote Link to comment Share on other sites More sharing options...
pthomass Posted June 21, 2005 Author Report Share Posted June 21, 2005 I know what it is. On another forum someone gave the solution.You need to type the following:shutdown.EXE -s -m\\computername -t....so the .EXE exctension needs to be present Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.