What are the differences between shutdown options

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
CuriousDad
Posts: 74
Joined: 21 Mar 2023, 11:23

What are the differences between shutdown options

Post by CuriousDad » 22 Mar 2023, 09:11

Hello. I was wondering what the differences are between the shutdown integers seen on the tutorial pages.

Namely, what is the difference between 1 - shutdown, 4 - force shutdown, 8 - power down.

My guess is that shutdown allows all processes to end. Forced shutdown closes any programs that might be not functional. Power down is like pulling the plug?

AutoHotKeys also allow us to use a combination of functions such as 5 (shutdown + force shutdown) and 9 (shutdown + power down).

My main question is when would one use each situation? Which is the best way to shutdown the computer (1 vs 4 vs 5 vs 8 vs 9)? My guess is that shutdown (1) is the most common way that most people shut off their computer. I have seen the opinion stating that shutdown isn't the best way if one has fast boot selected. I do not have fast boot selected so I think that my computer is completely ending all processes when I shut off my computer.

Thanks for any insight.

User avatar
mikeyww
Posts: 26851
Joined: 09 Sep 2014, 18:38

Re: What are the differences between shutdown options

Post by mikeyww » 22 Mar 2023, 10:30

Welcome to this AutoHotkey forum!

This question is already directly answered in the documentation.
To shutdown and power down the flag would be 9 (shutdown + power down = 1 + 8 = 9).
Independent of this, the question can be answered by running your script.

I agree that this is confusing. I think it might refer to the old days when it was actually possible to "shut down" a computer without shutting off the power. Perhaps the fast boot also has some effect here. For some computers, this (no power-down) might still lead to a sleep state. I am not certain why a code of 9 is better than a code of 8. Others here may know more.

My approach is to try it. If it works, then I stick with it!

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: What are the differences between shutdown options

Post by swagfag » 22 Mar 2023, 12:02

read here what the flags are doing https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-exitwindowsex
but from these explanations its not much clearer what behavior to expect on modern OSs either

CuriousDad
Posts: 74
Joined: 21 Mar 2023, 11:23

Re: What are the differences between shutdown options

Post by CuriousDad » 24 Mar 2023, 08:45

Thanks. Any one of those work for me. I was just curious if there is a best practice way to avoid problems with the computer. I usually don't worry about losing data with the force start, but wondered if that would cause problems down the road.

User avatar
mikeyww
Posts: 26851
Joined: 09 Sep 2014, 18:38

Re: What are the differences between shutdown options

Post by mikeyww » 24 Mar 2023, 12:38

Yes, if you would prefer not to lose data, then avoid the "force" option.

iseahound
Posts: 1444
Joined: 13 Aug 2016, 21:04
Contact:

Re: What are the differences between shutdown options

Post by iseahound » 24 Mar 2023, 12:56

Yes, as far as I know there is no real difference between 4 and 8, I assume powerdown and shutdown are the same thing on modern devices.

User avatar
mikeyww
Posts: 26851
Joined: 09 Sep 2014, 18:38

Re: What are the differences between shutdown options

Post by mikeyww » 24 Mar 2023, 19:10

The codes are below.

0 = Logoff
1 = Shutdown
2 = Reboot
4 = Force
8 = Power down

CuriousDad
Posts: 74
Joined: 21 Mar 2023, 11:23

Re: What are the differences between shutdown options

Post by CuriousDad » 25 Mar 2023, 09:47

Thanks. Besides during installing and uninstalling a program, can a force shutdown adversely affect a program besides losing any data that hasn't yet been saved? I wouldn't want to damage a program (necessitating a re-installation of the program) by doing a force shutdown.

User avatar
mikeyww
Posts: 26851
Joined: 09 Sep 2014, 18:38

Re: What are the differences between shutdown options

Post by mikeyww » 25 Mar 2023, 10:32

No, but some programs may depend on their own configuration files that also have not been saved. The program file itself would not typically be affected, though it's possible for a program file to alter itself. This would be uncommon. A well written program would not be fatally affected by a forced restart or forced shutdown.

CuriousDad
Posts: 74
Joined: 21 Mar 2023, 11:23

Re: What are the differences between shutdown options

Post by CuriousDad » 25 Mar 2023, 22:57

Thank you.

Post Reply

Return to “Ask for Help (v2)”