Fredledingue Posted June 15, 2007 Posted June 15, 2007 Thanks to a geek named Rischip on VBS forumThis script requires MS Word.I think it can work on every windows.Copy paste the code below into notepad and save it under Close_all_windows.vbs'Author Rischip'Home page [link=http://www.thegrimlinker.com]www.thegrimlinker.com[/link]'This script closes all open windows on the workstation'The script does not forcefully close applications 'therefore you will get a Save dialog on text editor apps and the like'before they close'This script requires Microsoft Word to be installed on your computerOn Error Resume Next'check to ensure running under wscript'if we are not it would be possible 'for the script to kill itself in the 'command window that cscript would have open'if we are cool, if not relaunch under wscriptIf Not LCase(Right(Wscript.FullName, 11)) = "wscript.exe" Then Set objShell = CreateObject("Wscript.Shell") objShell.Run "Wscript.exe " & WScript.ScriptFullName , 0, False WScript.quitEnd If'create Word objectSet objWord = CreateObject("Word.Application")'get collection of open windows Set colTasks = objWord.Tasks'enumerate open windows'checking for visibility'verify task is not program manager'otherwise you will get the logoff/shutdown/restart windowfor each objTask in colTasks If objTask.Visible Then If Not objTask.Name = "Program Manager" then colTasks(objTask.Name).Close End If End IfnextobjWord.Quit
whatever420 Posted June 16, 2007 Posted June 16, 2007 I use Closing Time...Works great... "Closing Time is a simple little program you can use to close open windows. It can close hidden windows as well as windows that don't have title bar." Closing Time v2.10
Rischip Posted July 14, 2007 Posted July 14, 2007 Hey, who are you calling Geek....... LMAOAt least spell my name correctly......
tain Posted July 14, 2007 Posted July 14, 2007 I use this version of close to close windows by title, but it uses wildcards so it can close all windows. It closes them in the "nice" way.@Rischip: Welcome to MSFN You might be interested in these subforums.
Rischip Posted July 15, 2007 Posted July 15, 2007 Thank You.This script actually closes windows in a "nice" way as well. If you've made edits to a document for instance. If the program offers the automated notification that the file has changed and to save it. You will get that prompt.I use this script to close all windows "but", example: you can include the title "Inbox - Microsoft Outlook"and if you are in Outlook on the Inbox page, it will not be closed. You can add any window title you wish.Rischip
Fredledingue Posted July 16, 2007 Author Posted July 16, 2007 If you can manipulate VBScript a little bit, the options are limitless.
technicalman Posted June 23, 2011 Posted June 23, 2011 Folks,I love this script!Is there any way i can adapt this to "Windows 7"? I run it and it closes everything but also tries to log off of windows. I added a wscript.echo for objTask.Name to see what was going on and it was saying "Program Manager" and then it said "Start". I tried getting it to ignore program manager and start, but it keeps trying to close those. processes. I'd love any help you can give me on this. Thanks,Randyfor each objTask in colTasks If objTask.Visible Then If Not objTask.Name = "Program Manager" then wscript.echo objtask.name colTasks(objTask.Name).Close End If End If
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now