Ask the Expert

Looking for VB script that will automatically shut down Win2k and XP

I would like to write a VB script to auto shut down Win2k and WinXP. I wrote the script and kept it in a *.bat file, but it still failed to shut down. Please advise.
When I started looking at this question, I didn't realize there were so many ways to shut down a machine! For Windows XP and Windows Server 2003, a new command line program, SHUTDOWN.EXE, takes all the work out of it. Using the command "SHUTDOWN -s -t 1" will turn off the computer immediately. The "-s" command line options specifies shutdown, and the "-t 1" says to delay one second (in other words, immediately). The SHUTDOWN program also powers off the machines if they have relatively recent BIOS.

In researching this question, I was all set to write some VBScript code to do the shutdown on Windows 2000 when I ran across Rob van der Woude's outstanding scripting resource page. On Rob's Web site there are all sorts of great Windows Script Hosting (WSH) examples as well as batch files galore.

This was first published in February 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: