Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now