
CloseWindow V1.2.1 - Freeware by Uwe Sieber


Closes windows by given window text and/or window class.

CloseWindow.exe is a Windows program, CloseWindowCmd.exe is a Console program.


The CloseWindow program is completely invisible unless no or an invalid commandline is given.

CloseWindowCmd is for usage in batch files, if started standalone Windows create a console window for it.

The command-line for both is the same:


Usage:

closewindow [-text="Window Title"] [-class="Window Class"] [-a] [-count=nn] [-wait=nnnn] [-w=nnnn]

-text or -class or both must be specified.
-a     try to activate the window if it does not close
-count is the maximum number of windows to close, default is 1.
-wait  is the maximum time to wait for the windows to appear and being closed
       default is 1000 milliseconds
-w     wait n milliseconds before close (only standalone started console version)

For class and text wildcards can be used:

*  -> 0..n characters
?  -> exactly one character

The class name of a window can be determined by means of my WinInfo tool:
http://www.uwe-sieber.de/files/wininfo.zip


Samples:

Close all Windows XP Calculators:

closewindow -class="SciCalc" -count=999


Close Explorer windows for drive U: (the option 'show full path in title bar' must be set)

closewindow -text="U:\*" -class="CabinetWClass" -count=999





errorlevels:

0    at least one window found and closed
1    at least one window but not closed within a second
2    no window found
4    error



Uwe Sieber
Dec 2025
