944,116 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 14894
  • C# RSS
You are currently viewing page 1 of this multi-page discussion thread
Aug 21st, 2005
0

shutdown.exe (Question)

Expand Post »
If i were tto implement somthing like this

cmd \k shutdown.exe -r

on a button click would that saftley restart y comp. from that app. if not how would i do this
Similar Threads
Team Colleague
Reputation Points: 84
Solved Threads: 99
<Insert title here>
tayspen is offline Offline
1,542 posts
since Jul 2005
Aug 22nd, 2005
0

Re: shutdown.exe (Question)

google is letting me down
Team Colleague
Reputation Points: 84
Solved Threads: 99
<Insert title here>
tayspen is offline Offline
1,542 posts
since Jul 2005
Aug 27th, 2005
0

Re: shutdown.exe (Question)

try this:


C# Syntax (Toggle Plain Text)
  1.  
  2. using System.Diagnostics;
  3.  
  4. ProcessStartInfo startinfo = new ProcessStartInfo("shutdown.exe","-r");
  5. Process.Start(startinfo);
Reputation Points: 23
Solved Threads: 16
Posting Whiz in Training
plazmo is offline Offline
206 posts
since Aug 2005
Aug 27th, 2005
0

Re: shutdown.exe (Question)

Quote originally posted by plazmo ...
try this:


C# Syntax (Toggle Plain Text)
  1.  
  2. using System.Diagnostics;
  3.  
  4. ProcessStartInfo startinfo = new ProcessStartInfo("shutdown.exe","-r");
  5. Process.Start(startinfo);

hmmm the r stands for restart so is l logoff?
Team Colleague
Reputation Points: 84
Solved Threads: 99
<Insert title here>
tayspen is offline Offline
1,542 posts
since Jul 2005
Aug 27th, 2005
0

Re: shutdown.exe (Question)

C# Syntax (Toggle Plain Text)
  1.  
  2. -i Display GUI interface, must be the first option
  3. -l Log off (cannot be used with -m option)
  4. -s Shutdown the computer
  5. -r Shutdown and restart the computer
  6. -a Abort a system shutdown
  7. -m \\computername Remote computer to shutdown/restart/abort
  8. -t xx Set timeout for shutdown to xx seconds
  9. -c "comment" Shutdown comment (maximum of 127 characters)
  10. -f Forces running applications to close without war
  11. ning
  12. -d [u][p]:xx:yy The reason code for the shutdown
  13. u is the user code
  14. p is a planned shutdown code
  15. xx is the major reason code (positive integer le
  16. ss than 256)
  17. yy is the minor reason code (positive integer le
  18. ss than 65536)

-l would be logoff
Reputation Points: 23
Solved Threads: 16
Posting Whiz in Training
plazmo is offline Offline
206 posts
since Aug 2005
Aug 27th, 2005
0

Re: shutdown.exe (Question)

Tahnk you and is thissafe for the computer?
Team Colleague
Reputation Points: 84
Solved Threads: 99
<Insert title here>
tayspen is offline Offline
1,542 posts
since Jul 2005
Aug 27th, 2005
0

Re: shutdown.exe (Question)

yeah its safe, its no different then going to cmd and using it
Reputation Points: 23
Solved Threads: 16
Posting Whiz in Training
plazmo is offline Offline
206 posts
since Aug 2005
Aug 27th, 2005
0

Re: shutdown.exe (Question)

Quote originally posted by plazmo ...
yeah its safe, its no different then going to cmd and using it

lol ok thanks so i guess its safe there
Team Colleague
Reputation Points: 84
Solved Threads: 99
<Insert title here>
tayspen is offline Offline
1,542 posts
since Jul 2005
Mar 3rd, 2008
0

Re: shutdown.exe (Question)

Click to Expand / Collapse  Quote originally posted by plazmo ...
C# Syntax (Toggle Plain Text)
  1.  
  2. -i Display GUI interface, must be the first option
  3. -l Log off (cannot be used with -m option)
  4. -s Shutdown the computer
  5. -r Shutdown and restart the computer
  6. -a Abort a system shutdown
  7. -m \\computername Remote computer to shutdown/restart/abort
  8. -t xx Set timeout for shutdown to xx seconds
  9. -c "comment" Shutdown comment (maximum of 127 characters)
  10. -f Forces running applications to close without war
  11. ning
  12. -d [u][p]:xx:yy The reason code for the shutdown
  13. u is the user code
  14. p is a planned shutdown code
  15. xx is the major reason code (positive integer le
  16. ss than 256)
  17. yy is the minor reason code (positive integer le
  18. ss than 65536)

-l would be logoff
I had an idea for a program and saw this. Thank you for the advice, it really helped; however, I am not sure how to implement it all...

... when using the following commands, what is the correct way to input it?

following the example code given earlier, I typed:
ProcessStartInfo startInfo = new ProcessStartInfo("shutdown.exe", "-m \\COMPUTERNAME");

upon clicking the button this code was written for, nothing happened on the computer I was trying to shut down, though (unfortunately) my computer restarted after approximately 30 seconds. I don't think I input it correctly, or I was attempting to do something -m wasn't meant to do?

Also, when I typed "-t 10" (wanting the computer to shut down 10 seconds after the button was clicked, nothing happened.

Wat am I doing wrong?
Thanks for the help
j4nu5
Reputation Points: 10
Solved Threads: 0
Newbie Poster
j4nu5 is offline Offline
2 posts
since Mar 2008
Mar 5th, 2008
0

Re: shutdown.exe (Question)

But why you use shutdown.exe?

There are API functions: ExitWindows, ExitWindowsEx, InitiateSystemShutdown, InitiateSystemShutdownEx. Try this.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Groblin is offline Offline
1 posts
since Mar 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Music on my website
Next Thread in C# Forum Timeline: DragAndDrop doesn't Move





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC