0

I have followed this here to run a batch file silently, in the background and doesn't show on taskbar, it's great.

How to run a batch file without launching a "command window"?

The thing is, when all batch file run, all of the process ID in task manager shows the same process Name. Different cmd.exe and conhost.exe by the user, so this means if I got 5 looping batch running they'll all show cmd.exe and conhost.exe and I have no idea which is which If I wish to restart them or end them.

enter image description here

How to get them with specific name?

ChanganAuto
  • 1,511
  • 3
  • 15
  • 19
Al So
  • 1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Dec 08 '23 at 17:55
  • 1
    Have you tried killing wscript.exe (or cscript.exe) instead? What happens if you do that? One other thing you could do is use a unique command line for launching your batch and use PowerShell/WMI to lookup the process by command line.. like this.. Get-WmiObject Win32_Process -Filter "name = 'conhost.exe'" | Select-Object CommandLine – Señor CMasMas Dec 08 '23 at 18:47
  • 2
    Perhaps you should thing about "Why do I need to do this?". Your solution to this problem probably rests with not making a batch file that loops forever and instead exits when it is done. I hope you aren't in IT. – Señor CMasMas Dec 08 '23 at 18:56
  • @SeñorCMasMas with the powershell cli, it just shows conhost.exe 0x4.. 4 of them lol. also task manager doesn't show wscript.exe id at all, maybe cause its ran from vbscript as hidden not sure. – Al So Dec 09 '23 at 01:57
  • if your using a vbs to start the script, you can use that vbs to also get it's own PID for use in identifying which cmd is a child of it for use with tasklist / taskkill. https://stackoverflow.com/questions/8296037/find-my-own-process-id-in-vbscript#:~:text=To%20retrieve%20the%20own%20process,that%20runs%20the%20same%20script. – T3RR0R Dec 28 '23 at 15:14

0 Answers0