0

The following is nothing to do with where the mouse is when the command is issued, as that should be irrelevant. As the command specifies what to close.

I would like to have a command that will close particular windows.

For example.

For the command prompt, no problem, I know. taskkill /f /im cmd.exe windows For charmap.exe ditto.

Now for closing the windows of another taskbar icon, from the command line..i've provided a screenshot of the windows i'd like to close.

Is there a command that would do it?

Any time I see those there, so maybe a unique hex id would only work that one time, and if it were window titles that's ok and better but not ideal because really I want to close windows associated with particular taskbar icons.

enter image description here

1 Answer 1

0

You can't.

These windows are displayed by Windows Explorer (explorer.exe), which is one process in charge of displaying the desktop, the taskbar and Start menu, folder windows, and other windows implemented as Shell folders (like the ones you're interested in). To close them, you'll need to manipulate Scriptable Shell Objects with some vbScript/PowerShell scripts.

Note that you can close cmd.exe or charmap.exe windows using Taskkill only because these windows belong to separate processes (cmd.exe and charmap.exe).

3
  • do they have a hex code that changes all the time?(meaning that if I restart and open the same window, will it have a different hex code?). if so, i'd only be able to do it by window title as at least that wouldn't change, which could still work.
    – barlop
    Jan 2, 2014 at 16:04
  • By "hex code" I presume you mean process ID you can use with taskkill /PID. So no, they don't have a process dedicated to them, so they can't have a process ID. Again, you'll have to script against the shell.
    – Jonathan
    Jan 2, 2014 at 16:09
  • no i do not mean PID. I mean haven't you ever seen one of those programs that shows the window handler as a hex code, that thing. And nirsoft's tool might be able to close it via that. (or via window title). Or something programmed might be able to close it given an identifier. Obviously not a PID, but an identifier.
    – barlop
    Jan 2, 2014 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .