Re: enumerating top level windows

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 07/06/04


Date: Tue, 06 Jul 2004 20:27:02 +0200

Gary Roach wrote:

> i want to enumerate top level windows using a script. i've already looked at
> Karl Peterson's site for vb
> (http://www.mvps.org/vb/index2.html?samples.htm). i'm wondering if the same
> thing can be accomplished using wmi. all i can find is the ability to
> enumerate processes. i want top level windows so that i can close apps. any
> idea how to do this? thanks,
Hi

Nothing builtin you can access from a script can do this.

Here us two free command line utilities you can e.g. run from a network
share, nothing needs to be installed on the local computer if you don't
want to. You can e.g. redirect the output to a temporary file and parse
it from your vbscript.

CMDOW Commandline Window Utility (with /T: List only the windows shown
on the taskbar)
http://www.commandline.co.uk/cmdow/index.html

Enum.exe in the Command Line Tools (CMDLINE.ZIP), lists all visible
top-level windows
http://www.cmdtools.com/

-- 
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/community/scriptcenter/default.mspx


Relevant Pages

  • Re: Windows error message
    ... > MS-DOS andMicrosoft Windows applications. ... Error message when you install or start an MS-DOS or 16-bit ... In the command prompt, type in the following two commands exactly as ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.general)
  • Re: SP2 &16 bit programs
    ... The system file is not suitable for running MS-DOS and MS Windows applications... ... WinXP SP2 and AVAST installed, ... In the command prompt, type in the following two commands exactly as ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windowsxp.general)
  • Re: Cant access System Information
    ... Rebuilding the WMI Repository ... Type this command and press Enter: ... net start winmgmt ... MS-MVP Windows Shell/User ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Unable to connect to WMI service
    ... The Window management Instrumentation (WMI) ... > system restore to restore windows to an earlier time ... Subject: Windows XP WMI Reinstall ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.security_admin)
  • Re: How do Unix grep, find, sort?
    ... > to give Windows a fair shot, but I'm having a heck of a time getting started. ... > But I've been studying VBScript all day, and I swear I cannot figure out how ... Command line utilities that does the job much better: ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windows.server.scripting)