Jump to content
czmaster

Prevent a script from closing on Windows shutdown

Recommended Posts

czmaster

hello,

I have a script that I would not like to close before the end of its execution. If the user decides to close Windows I would like to prevent the shutdown of Windows.
For that I found several examples on this forum for example this one:

Blocking works well with just a While Loop execution.
But if we add other autoit commands (run, inetget ...), the script is closed on closing Windows after a few seconds.

Do you have any solution to prevent closing.

Thank you.

Share this post


Link to post
Share on other sites
Earthshine

this sounds like evil doings going on.


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Jos
5 minutes ago, Earthshine said:

this sounds like evil doings going on.

Isn't that statement somewhat judgmental and shouldn't that be: Why would you want to do this?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
KaFu
12 hours ago, czmaster said:

Blocking works well with just a While Loop execution.

Fileinstall a second .exe doing just that, run it in the background as a helper process and kill it when main process is done?

Share this post


Link to post
Share on other sites
czmaster
12 hours ago, JohnOne said:

You want to prevent a user from shutting their own device down?

 

12 hours ago, Earthshine said:

this sounds like evil doings going on.

Even with the method that works the user can allways force the shutdown in Windows, this is equivalent to an unsaved modified file that prevents Windows from closing.

12 hours ago, Jos said:

Isn't that statement somewhat judgmental and shouldn't that be: Why would you want to do this?

Jos

Any kind of action that will take some time : backup, antivirus and personal script.

Edited by czmaster

Share this post


Link to post
Share on other sites
Bert

Nothing can prevent shutdown for one reason - The user can cut the power to the computer. 

If you are trying to push a package to the PC - it would be best to have the package install in the background while the user is using the computer. There are many resources that explain how to do  it. Google is your friend. 

  • Like 1

Share this post


Link to post
Share on other sites
Earthshine

How about holding down the power button until it shuts off


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.