Rename the process

Asked

Viewed 931 times

1

I have a script made in Windows CMD and wanted to see if it is possible to change the name of the process when it runs.

Example:

I have 3 script (1-ler_log.bat; 2 - recicle.bat; 3 - Alarm_alter.bat) when they run in Task Manager the process name is cmd.exe (for running inside CMD) but I would need each of them to generate a process with their respective names (as they rotate every 5 minutes and sometimes lock and I have to close all and open configure all again because of 1 only locked)

2 answers

1

In that case you can use the PID process to differentiate them with the title

example :

@echo off

set "$title=test2"

title %$title%

tasklist /FI "WINDOWTITLE eq %$title%" | find /i "console" >nul && echo processus com titulo [%$title%] encontrado || echo processus com titulo [%$title%] nao encontrado

exit :

processus com titulo [test2] encontrado

now if you change the title by test23 :

@echo off

set "$title=test2"

title test23

tasklist /FI "WINDOWTITLE eq %$title%" | find /i "console" >nul && echo processus com titulo [%$title%] encontrado || echo processus com titulo [%$title%] nao encontrado

Exit :

processus com titulo [test2] nao encontrado

just make another bat that will test the 3 titles in loop

-2

For all being in .bat it should not be possible to generate different processes, since all are interpreted by cmd. I suggest you create executable files .exe to generate different processes. This video shows how to convert .bat in .exe: video

Browser other questions tagged

You are not signed in. Login or sign up in order to post.