Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

20 Experts available now in Live!

Get 1:1 Help Now