Batch, Developer Tool, Programming

CMDS – View and manage cmd.exe windows [Developer Tool]

For more advanced batch scripts, you may want to run a cmd.exe instance in the background. However, it can be hard to tell if it is running or not once you’ve launched it. CMDs allows you to see open windows in the foreground and background as well as find the PID of any cmd.exe window based on its title.

Not only can users do this from a simple (and colorful) text-based GUI, developers can also use it’s simple, built in commands designed for batch coders!

Update: 12/04/2021 – CMDS has gotten a big update adding stability and error-checking, as well as an option to check for updates (no automatic downloads for safety).

CMDS is a pretty simple tool to use. Here’s the help documentation:

CMDS Command Prompt Window Lister by IT Command

CMDS [/S] [/P] [/L] [/W] [/V] [/Ver] [/G Num] [/K Num] [/TK String] [/TS String]

 /S         Displays the simple but high information version (fast)
 /P         Pauses Before Exiting. Usefull if using from Run.
 /L         Pauses and refreshes on press of key. Use CTRL+C to quit.
 /W         Refreshes only when a new cmd instance starts (new PID).
 /G         For use when listing entries. Copies an entry from a
            displayed list to clipboard.
 /K         For use when listing entries. Kills an entry from
            displayed list.
 Note:      /G and /K will pull numbers and PIDs from the previous CMDS
            list through a variable to increase accuracy.
 Num        The number of the entry to copy to clipboard or kill.
 /V         Ignores unnamed windows.
 /Ver       Prints the current version of CMDS and allows you to check
            for an update. /version may also be used.
 /TS        Use within a batch file to search for a Window Title.
 /TK        Use within a batch file to kill a matching Window Title.
 String     The Window Title to search for with /TS or /TK

 with /TS the errorlevel will be set to 1 if the title was not found.
 If it is found, the errorlevel will be set to the PID of the cmd instance.


   CMDS /TS "My Window"

    The Above Command Will set the errorlevel to the PID of the cmd instance
    with the title "My Window" (set with the title command). If the instance
    is not found (there is no running window) the errorlevel will be 1.
    if the Syntax was incorrect, errorlevel will be set to 2.

 Created by Lucas Elliott with IT Command

There’s a few things to check out here. First, the basic functionality of CMDS allows you to view what windows are open. On my machine, running CMDS outputs the following:

screenshot of CMDS

As you can see, CMDS neatly displays the titles, memory usage, and pids of all of the open CMD windows, including ones launched in the background. It also shows windows with no unique title, including the one that is currently running CMDS (see the bottom two), although these can be ignored by adding /v to the CMDS command.

Users can also use CMDS /w which will refresh whenever a CMD window is opened or closed in order to display an up-to-date list at all times.

However, CMDS’ more advanced functionality is in its /TS functionality. In the example above, there is a batch file running called “Crafty Controller”. Let’s say you knew that was running and wanted to kill the process from another batch file. With CMDS this is easy. Take this command for example:

CALL CMDS /TS "Crafty Controller"

If you ran this command, it would not provide any output on screen. Instead, the errorlevel will now be set to the PID of the Crafty Controller window!

What if you weren’t sure it was running? Well, if CMDS doesn’t find an instance running with the given title, it sets the errorlevel to 1. Pretty easy!

taskkill /f /pid %errorlevel%

However, in this example it gets easier. CMDS now has a built in feature to kill tasks:

CALL CMDS /TK "Crafty Controller"

You can also kill tasks from a cmds list and copy task PID’s from the numbered list in CMDS.

cmds /k 1

How easy is that? Obviously this is a powerful tool for batch developers. It’s written 100% in batch with no executables or dependencies. The code is, of course, open source and under the GNU public license.

Anyone can download the script at

6 thoughts on “CMDS – View and manage cmd.exe windows [Developer Tool]

  1. This is amazing work. Really nice.
    And, the simplicity of its usage is tremendous.
    I have re-edited your article a bit to add ‘CODE Blocks’ to the two Syntax at the bottom of the article.
    nice work – and the video demo is nice.

    1. I have an improvement suggestion… Why don’t you add support for Selecting/Saving a PID of the window with Index number in the list.

      For example,
      CALL CMDS /TS "Crafty Controller"
      becomes same as
      CALL CMDS /I 1

      Because, it is listed on the 1st index of the list.

Leave a Reply