Basj Basj - 4 months ago 37
Python Question

Make python process name more explicit

When I run the taskmanager, the process name for all Python scripts are the same :

python.exe
. It makes it difficult to know which is which.

How to change the process name displayed by Windows task manager?

Note: this question doesn't seem to work for Windows.

enter image description here

Answer

Create a new file named python-by-name.bat in the python directory with the following contents:

set PYTHON_HOME=%~dp0
set PYTHON_NAME=%1.exe
copy "%PYTHON_HOME%\python.exe" "%PYTHON_HOME%\%PYTHON_NAME%"
set args=%*
set args=%args:* =%
"%PYTHON_HOME%\%PYTHON_NAME%" %args%

Now, instead of typing:

python <arguments>

Use:

python-by-name my_program <arguments>

now my_program will appear in the taskmanager instead of python.

see Changing the process name of python script in windows for more details.

Comments