User Tools

Site Tools


shutting_20down_20the_20pc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

shutting_20down_20the_20pc [2018/03/31 13:19]
127.0.0.1 external edit
shutting_20down_20the_20pc [2018/04/15 11:09] (current)
richardrussell Added syntax highlighting
Line 1: Line 1:
 =====Shutting down the PC===== =====Shutting down the PC=====
  
-//by Richard Russell, October 2007//\\ \\  It's not a very likely thing to want to do, but the code below **shuts down** the PC when executed. Note that if run under //Windows 2000 Professional//,​ //Windows XP Professional//​ or //Windows Vista// it's entirely likely that the system adminstrator will have disabled the ability of ordinary user programs to shut down the PC. In that case the program will fail with the //Cannot acquire Shutdown privilege// message.\\ \\ +//by Richard Russell, October 2007//\\ \\  It's not a very likely thing to want to do, but the code below **shuts down** the PC when executed. Note that if run under //Windows 2000 Professional//,​ //Windows XP Professional//​ or //Windows Vista// it's entirely likely that the system adminstrator will have disabled the ability of ordinary user programs to shut down the PC. In that case the program will fail with the //Cannot acquire Shutdown privilege// message. 
 + 
 +<code bb4w>
         REM. Caution: this program shuts down the computer!         REM. Caution: this program shuts down the computer!
  
Line 23: Line 25:
         SYS "​ExitWindowsEx",​ _EWX_POWEROFF,​ &FFFF TO ok%         SYS "​ExitWindowsEx",​ _EWX_POWEROFF,​ &FFFF TO ok%
         IF ok% PRINT "​System shutting down...."​         IF ok% PRINT "​System shutting down...."​
 +</​code>​
 +
 You may alternatively wish to change the **_EWX_POWEROFF** value to **_EWX_SHUTDOWN** ("​=1"​) which doesn'​t turn the power off or **_EWX_REBOOT** ("​=2"​) which restarts the system. You may alternatively wish to change the **_EWX_POWEROFF** value to **_EWX_SHUTDOWN** ("​=1"​) which doesn'​t turn the power off or **_EWX_REBOOT** ("​=2"​) which restarts the system.
shutting_20down_20the_20pc.txt · Last modified: 2018/04/15 11:09 by richardrussell