Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Software Development Software Development
Search Search
Search for:
Tech Support Guy > > >

Solved: Shutdown DOS batch script


(!)

jp1203's Avatar
jp1203 has a Photo Album
Computer Specs
Member with 3,427 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Massachusetts
05-Jul-2007, 12:31 PM #1
Solved: Shutdown DOS batch script
I have absolutely no idea where to put this, so I just picked a place. If anyone thinks there's a better spot for it, have it moved there please

My intentions: to make a DOS batch script that will shut down four machines, then to set it as a scheduled task running at, say, 1 AM

The Problem:
I type something in DOS:

shutdown -s -m \\computername -c "This machine will shut down in two minutes To cancel click the abort shutdown icon on your desktop" -t 120 -f

It works, the remote machine displays a warning and a countdown timer. I have an icon on their desktop that is a batch script with contents:

shutdown -a

to abort the shutdown if someone is on the machine at 1 AM.


If I copy the same script (the shut down one) into notepad save and run the batch file, it goes into this endless loop and does nothing. Anyone know why?

I've attached a screenshot of the running batch script in its endless loop"
Attached Thumbnails
Solved: Shutdown DOS batch script-shutdownloop.jpg  
dez_666's Avatar
dez_666 dez_666 is offline   dez_666 has a birthday soon!
Computer Specs
Senior Member with 842 posts.
 
Join Date: May 2007
Location: Sacramento, California
Experience: Advanced
05-Jul-2007, 01:52 PM #2
Can you put the contents of your batch script in CODE tags please? Maybe i can help you out.
jp1203's Avatar
jp1203 has a Photo Album
Computer Specs
Member with 3,427 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Massachusetts
05-Jul-2007, 05:02 PM #3
Changed it slightly with some echo tags, that's all. Still obviously no go.

Code:
@echo off
echo Starting Shutdown Process...
echo Shutting Down Stergis2
shutdown -s -m \\computername -c "This machine will shut down in two minutes To cancel click the abort shutdown icon on your desktop" -t 120 -f
echo Script Complete.
Attached Thumbnails
Solved: Shutdown DOS batch script-script.jpg  
dez_666's Avatar
dez_666 dez_666 is offline   dez_666 has a birthday soon!
Computer Specs
Senior Member with 842 posts.
 
Join Date: May 2007
Location: Sacramento, California
Experience: Advanced
05-Jul-2007, 05:09 PM #4
Ok let me ask this- Are you sure shutdown.exe is on your PC? and the remote pc? cos iytmay need it, and there might be a setting on the remote computer that allows it to be shut down remotely.
jp1203's Avatar
jp1203 has a Photo Album
Computer Specs
Member with 3,427 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Massachusetts
05-Jul-2007, 05:18 PM #5
I imagine so, because if I just open cmd and type this it works fine and the other machine shows a message for two minutes and shuts down. It's just the script that won't work for some weird reason:

shutdown -s -m \\computername -c "This machine will shut down in two minutes To cancel click the abort shutdown icon on your desktop" -t 120 -f
dez_666's Avatar
dez_666 dez_666 is offline   dez_666 has a birthday soon!
Computer Specs
Senior Member with 842 posts.
 
Join Date: May 2007
Location: Sacramento, California
Experience: Advanced
05-Jul-2007, 05:20 PM #6
:3 I have a neato idea. but first lemme ask you. would you be willing to use something other than shutdown.exe to shutdown other pc's?
jp1203's Avatar
jp1203 has a Photo Album
Computer Specs
Member with 3,427 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Massachusetts
05-Jul-2007, 05:22 PM #7
So long as it isn't too bulky, probably.
dez_666's Avatar
dez_666 dez_666 is offline   dez_666 has a birthday soon!
Computer Specs
Senior Member with 842 posts.
 
Join Date: May 2007
Location: Sacramento, California
Experience: Advanced
05-Jul-2007, 05:31 PM #8
two things.

PsShutdown from Sysinternals - Now owned by microsoft..

http://www.microsoft.com/technet/sys...sShutdown.mspx

doesnt require anything installed on the client.

but if you're a little adventurous, check this out.

http://users.pandora.be/jbosman/applications.html

you dont 'need' to install it on the remote pc, but if you dont you cant do any of the fancy things like standby and hibernate..or turning a monitor off.. xD
but pwroff can do things by a scheduling them, and things can be done by command line, as well as remotely by command line. i wouldnt recommend it if you're looking for an easy solution, but its a fun program.
jp1203's Avatar
jp1203 has a Photo Album
Computer Specs
Member with 3,427 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Massachusetts
05-Jul-2007, 05:37 PM #9
Cool, I'll have to try that Poweroff thing. I like to play

Thanks Very Much
dez_666's Avatar
dez_666 dez_666 is offline   dez_666 has a birthday soon!
Computer Specs
Senior Member with 842 posts.
 
Join Date: May 2007
Location: Sacramento, California
Experience: Advanced
05-Jul-2007, 05:42 PM #10
you ought to check out the sysinternals suite in my sig. very useful tools in der.
But dont get carried away, you can fry your PC with some of that stuff.
but yea, tell me how poweroff goes, i love that thing xD
jp1203's Avatar
jp1203 has a Photo Album
Computer Specs
Member with 3,427 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Massachusetts
05-Jul-2007, 05:50 PM #11
I use newsid from Sysinternals for mass imaging stuff so the SID and puter name are different for every box. Haven't really played with the rest of the stuff too much, I'll have to do that when I have some time to kill. I had a guy working with me who decided that NewSID locked up (it just hit a massive file to change) and rebooted the machine manually. Had to reimage it again.

I scheduled poweroff to shut down a box at 1 AM with a 120 second warning, and started it as a service so we'll see what happens. I'll let you know.

Thanks again
jp1203's Avatar
jp1203 has a Photo Album
Computer Specs
Member with 3,427 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Massachusetts
05-Jul-2007, 05:52 PM #12
I like the looks of diskmon, as I run this box as a small server. I'll have to play with that.
dez_666's Avatar
dez_666 dez_666 is offline   dez_666 has a birthday soon!
Computer Specs
Senior Member with 842 posts.
 
Join Date: May 2007
Location: Sacramento, California
Experience: Advanced
05-Jul-2007, 05:56 PM #13
When you make a scheduled task in pwroff, dont forget to 'Save Setting To Service'.
And diskmon is for monitoring when your hard drive is read/written to. i find regmon more useful than that >_>'

Last edited by dez_666; 06-Jul-2007 at 12:28 PM..
jp1203's Avatar
jp1203 has a Photo Album
Computer Specs
Member with 3,427 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Massachusetts
06-Jul-2007, 08:17 AM #14
Apparently the service ran, when I unlocked this this morning I had a poweroff message that the client accepted the task and that machine is off.

Thanks
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑