Skip to main content
mauricior6328708
Inspiring
March 16, 2022
Answered

Check if a .exe program is running

  • March 16, 2022
  • 2 replies
  • 722 views

Hello everyone, everything good?
How do I check if the application (.exe ) is running through script? Thanks in advance.

This topic has been closed for replies.
Correct answer r-bin

checked on win7 cs6

var exe_name = "Roland VersaWorks.exe"

var tmp_name = "tmp.tmp"

system("tasklist >%TEMP%/"+tmp_name)

var file = new File(Folder.temp.fsName + "/" + tmp_name);
file.open("r");
var s = file.read();
file.close();
file.remove();

if (s.search(new RegExp(exe_name, "i")) >= 0)
    alert(exe_name + " is running")
else
    alert(exe_name + " is not running")

2 replies

r-binCorrect answer
Legend
March 16, 2022

checked on win7 cs6

var exe_name = "Roland VersaWorks.exe"

var tmp_name = "tmp.tmp"

system("tasklist >%TEMP%/"+tmp_name)

var file = new File(Folder.temp.fsName + "/" + tmp_name);
file.open("r");
var s = file.read();
file.close();
file.remove();

if (s.search(new RegExp(exe_name, "i")) >= 0)
    alert(exe_name + " is running")
else
    alert(exe_name + " is not running")
mauricior6328708
Inspiring
March 16, 2022

Hi @r-bin, here in the latest version of photoshop/W10 it worked perfectly fine. great. Thanks for sharing.

Kukurykus
Legend
March 16, 2022

You can check process identificator (pid) with .vbs. Just google it yourself 😉

mauricior6328708
Inspiring
March 16, 2022

Hi @Kukurykus ! I have a very complex script exporting in batch after performing some adjustments on images which then opens the "Roland VersaWorks.exe" printing software whenever it is executed, however, the problem is that if it is already is running, shows an unwanted message. My objective is to check if "Roland VersaWorks.exe" is already running, if it's true, don't run it again.
I tried to follow your advice and googled it, but I confess I was not able to understand any of this language.

Kukurykus
Legend
March 16, 2022

You should type in google same phrase like how to check pid vbs. When you know it you can remove process by command prompt using system() method or still by .vbscript.