Rename process

1

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

Example:

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

    
asked by anonymous 01.08.2018 / 16:09

2 answers

1

In this case you can use PID of the processes to differentiate them with 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

output:

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

Output:

processus com titulo [test2] nao encontrado

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

    
12.08.2018 / 14:41
-1

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

    
01.08.2018 / 16:20