This is very nice solution, I have a similar problem with batch files. How can I change the process name of a batch file which is always `cmd.exe` for any batch file ?

I have adjusted the script to allow to distinguish between those batch files.

## Overview

When `demo.bat` script file is invoked, The system will invoke `cmd.exe` with the following command line arguments `cmd.exe /C demo.bat`. Therefore, when several batch files are running simultaneously - `Windows Task Manager` will show several processes whose image name (the name of the binary file which is executed by the process) is `cmd.exe`. How can we distinguish between them ?

The basic idea is to copy `cmd.exe` to a `unique-name.exe` and then running `unique-name.exe /C <batch-file`. Now `unique-name.exe` will be displayed as process image name in `Windows Task Manager`.

## The script

Create a new file named `batch-by-name.bat`:

batch-by-name.bat
``````echo off
set program=c:\Windows\system32\cmd.exe
set alias_name=%1
set alias_path=%~dp0
set batch_file=%2
set alias=%alias_path%%alias_name%.exe
call :find_args %*
%alias% /C %batch_file% %args%
:find_args
set args=
shift
shift
:loop
if [%1] == [] goto :eof
set args=%args% %1
shift
goto :loop
copy %1 %2
``````

## Usage

Now, Let’s see how we can use this above batch to distinguish between your batch scripts.

Suppose you want to run the following command:

``````my.bat <arguments>
``````

``````batch-by-name my_unique_name my.bat <arguments>
Now, `my_unique_name.exe` process will appear in `Windows Task Manager` instead of `cmd.exe`.