Solved

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

Posted on 2006-11-20
5
2,740 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl script to parse xml file 2 114
Port 80 requests 16 96
Using Perl DBI to query oracle 3 43
html form to write data to csv 24 114
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 …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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