Jump to content

Prevent a script from closing on Windows shutdown


czmaster
 Share

Recommended Posts

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.

Link to comment
Share on other sites

  • Developers
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

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.
  :)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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. 

Link to comment
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
 Share

  • Recently Browsing   0 members

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