It looks like you're using an Ad Blocker.

Please white-list or disable in your ad-blocking tool.

Thank you.


Some features of ATS will be disabled while you continue to use an ad-blocker.


Shut down snippet

page: 1

log in


posted on Jul, 11 2005 @ 09:09 AM
Does anyone know a code snippet to shutdown a XP comp ?

posted on Jul, 11 2005 @ 10:37 AM
A little more information about your code type, and reasons for needing this would enable better help.

For example, are you talking about remote shutdown? C, C+, C++, VBS, Perl, command line, etc.

Anyway, here is a VBS code snippet.

Declare function Exitwindows lib "User32" alias "ExitWindowsEx" (byval option as string , byval charge as string)

shell ("Shutdown /r /t 0")

Best of luck

posted on Jul, 12 2005 @ 04:38 AM
I am getting errors with the code. But thanks anyway, i'll try to make it work somehow.

posted on Jul, 23 2005 @ 07:59 PM
If all you want to do is shut the computer down then the shutdown command works fine. This is from MS-DOS (if you go Start>Run type "cmd" then press enter). If you wish to run this at a time bung it in a batch file - this can be run manually, with "Scheduled Tasks" and can be run with most programming languages (pretty sure VB supports it)

For more info on batch files:


Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

No args Display this message (same as -?)
-i Display GUI interface, must be the first option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c "comment" Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without warning
-d (u) (p):xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive integer less than 256)
yy is the minor reason code (positive integer less than 65536)

Credit for syntax to

Coincidentally if you get the virus that shutsdown your computer (with a warning message) it is the same command as this with the time setting enabled. To stop it just go Start>Run type "shutdown -a" and it will stop

EDIT - Sort out problem with square brackets

[edit on 23/7/05 by Infidellic]


log in