Tripredacus Posted August 17, 2015 Share Posted August 17, 2015 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 More sharing options...
gunsmokingman Posted August 17, 2015 Share Posted August 17, 2015 I believe in earlier versions of Wscript you needed to close the object created by using Obj = Nothing, but in newer version it is not needed. Link to comment Share on other sites More sharing options...
jumper Posted August 19, 2015 Share Posted August 19, 2015 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). 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now