Solved

Get the full path of a running process in Windows 2000/Xp

Posted on 2006-11-20
5
2,751 Views
Last Modified: 2008-01-09
How to get the full path of a specific running process called OnEarth.exe in Windows 2000/Xp. This path will be used to open a definition file and get a database name.
The purpose is as follows: This process can run from several directory locations. Each location contains the startup definition file from which the process gets the database name to connect with.
The perl script will connect to this database and run a sql program.
0
Comment
Question by:mordi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 18

Accepted Solution

by:
Morcalavin earned 102 total points
ID: 17979548
use Win32::Process::Info;

$pi = Win32::Process::Info->new;
@info = $pi->GetProcInfo();
foreach(@info) {
      if($_->{Name} =~ /^OnEarth.exe$/) {
                #The below line will print the full path to the executable
            print "$_->{ExecutablePath}\n";
      }
}
0
 
LVL 3

Author Comment

by:mordi
ID: 17980667
I got following error:
Can't locate Win32/Process/Info.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at C:\Mordi\Dba\perl\get_proc_path.
pl line 1.
BEGIN failed--compilation aborted at C:\Mordi\Dba\perl\get_proc_path.pl line 1.
0
 
LVL 18

Expert Comment

by:Morcalavin
ID: 17981003
You don't have it installed.  Bring up a console window, go to your c:\perl\bin direcotry and type:
ppm install Win32-Process-Info
0
 
LVL 8

Expert Comment

by:koppcha
ID: 17981011
You need to download that module from CPAN
0
 
LVL 39

Expert Comment

by:Adam314
ID: 17981030
You need to add that module.  If you are using activestate (my guess if on win2000), use PPM:

go to a command prompt
type "ppm {enter}"
at the ppm prompt, type "search win32"
you will get a list of modules, with a number to the left of each
look for "Win32-Process-Info" (you might have to hit space to get the next page)
notice the number next to it
type "i <number>", where number is from the previous step
type quit

try to run the above script again
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question