Jump to content

Check process - (Moved)


Recommended Posts

Hi

With the following line I read out a process ID based on the path.
$s_Path = StringReplace($serverdir & $absolutedir & $g_c_sServerEXE, "\", "\\")
    $g_sPID = ObjGet("winmgmts:").ExecQuery('SELECT ProcessID FROM Win32_Process WHERE ExecutablePath="' & $s_Path & '"', "WQL", 16).ItemIndex(0).ProcessID
 
If the process does not exist, I get an error message. Which means I have to check beforehand whether the process exists. Does somebody has any idea.
Link to comment
Share on other sites

Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

you can even read the execution path. i have done this when writing a simple process finder

 

read the help

Function _WinAPI_GetProcessFileName (autoitscript.com)

Retrieves the fully-qualified path of the executable file for the specified process

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...