Jump to content

Recommended Posts

Posted (edited)

Hi all


For years, my script Powers Off my computer using Shutdown(8).

I now see in the help file, in the Shutdown's command help page, this line:

Quote

To shutdown and power down, for example, the code would be 9 (shutdown + power down = 1+8=9).


What is the difference between Shutdown(8) and Shutdown(9)?


From what it seems, Shutdown(8) does Turn Off my computer..
All LEDs go off, so does anyone know what's the difference bewteen the 2?

And should I switch to 9?


Thank you

Edited by Zohar
Posted

What i found so far( I'm not 100% sure either ;)) :

Shutdown
-> 1 = Shutdown - Shuts down computer
-> 8 = Power down - This action physically powers off computer -> Hardware must support this

8+1 may cover the case, that the hardware does not support "Power Off" ?. On my PC both variants (even 1 or 8 alone) lead to the same result.

Alternatively you could call the Shutdown.exe from Windows directly :

Run(@SystemDir & "\shutdown.exe /s /t " & $iDelayInSecs, "", @SW_HIDE) ; Delay in seconds, if desired (e.g. : 0 = immediate, 60 = in 60 seconds)

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

  • Developers
Posted (edited)

You can see the difference here: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-exitwindowsex?redirectedfrom=MSDN

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
23 hours ago, Jos said:

Thank you Jos,
fantastic link - really useful.

From that table, it seems that EWX_POWEROFF (0x00000008) includes in it the functionality of EWX_SHUTDOWN 0x00000001..


EWX_POWEROFF 0x00000008
Shuts down the system and turns off the power.

EWX_SHUTDOWN 0x00000001
Shuts down the system to a point at which it is safe to turn off the power.


So that's probably why it worked for me all these years

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...