| 1. |
Solve : Check if a program exists? |
|
Answer» Does anyone know how to check if a progress exists witch DOS? I'd like to do the following Quote from: DeltaSlaya on August 22, 2007, 04:03:55 AM Firstly, I assume you don't mean DOS, you mean a Batch file that the command line will interpret commands from. I mean a batch file, correct. The programm is installed like a normal program with a lot of files and directories. Afcourse there is a difference between a program and a progress. You have for instance notepad, and you can only check if notepad is LAUNCHED if the process notepad.exe exists. The progress itself wouldn't be created by the batch file, it would just LAUNCH the programm by doing "c:/program.exe". Thanks for your help so far OH I see, you mean process... Yea that's easy ENOUGH: Quote How do you get a lists of taskes 'cause tasklist doesn't work here.. Thanks so far for your helpTasklist doesn't do anything at all? What OS?Quote from: DeltaSlaya on August 22, 2007, 04:22:31 PM Tasklist doesn't do anything at all? winxp homeAre you sure tasklist doesn't do anything? It should, shouldn't it ? ? Try the CODE again and tell me the exact output.tasklist doesn't come with XP home. you can download from this site. Here . you can also use pslist and pskill . Otherwise here's a vbscript. Code: [Select]status = 0 Set Processes = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2").ExecQuery("select * from Win32_Process") For each Process in Processes If Process.Description = "the_process_you_want_to_check.exe" Then status=1 End If Next If status = 0 Then Set WshShell = CreateObject("WScript.Shell") WshShell.Exec("program_2") End If |
|