Jump to content

Still need to clear your var if you shutdown?


Recommended Posts

I know this is a standard practice, but is this actually necessary in a situation where you are shutting down the computer?

dim objShellset objShell = CreateObject("shell.application")objshell.ShutdownWindowsset objShell = nothing
^ above, setting objShell to nothing... not actually necessary because either the shutdown sequence will kill the application/script or the fact that the script immediately ends?

Just a conversation topic. Code sample from here:

http://www.msfn.org/board/topic/174021-startisback-10/page-9?p=1105751#entry1105751

Link to comment
Share on other sites


Shell.ShutdownWindows doesn't shut down windows, it "[d]isplays the Shut Down Windows dialog box. This is the same as clicking the Start menu and selecting Shut Down."

So if the dialog is cancelled, the call will return. Therefore the object should be released as in your sample code (same as on MSDN at above link).

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
  • Recently Browsing   0 members

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