473,568 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

path of a process or service

Hi,
I need the directory of a running process or service's executable. Any
ideas how to do this?

I looked up some Win APIs but none to accomplish this task.

I noticed there is a .StartInfo.Work ingDirectory in the process object
but it is always empty. I would think that the working dir would be the
same as the EXE if not defined.

Aug 31 '06 #1
5 1790
System.Diagnost ics.Process.Mai nModule.FileNam e

<wh*******@gmai l.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
Hi,
I need the directory of a running process or service's executable. Any
ideas how to do this?

I looked up some Win APIs but none to accomplish this task.

I noticed there is a .StartInfo.Work ingDirectory in the process object
but it is always empty. I would think that the working dir would be the
same as the EXE if not defined.

Aug 31 '06 #2
The only option I see in C# is
string AppPath = System.Windows. Forms.Applicati on.StartupPath;
MessageBox.Show (AppPath);

I think you can google and find better option if this doesn't work.
Regards,
Rajesh
Siva M wrote:
System.Diagnost ics.Process.Mai nModule.FileNam e

<wh*******@gmai l.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
Hi,
I need the directory of a running process or service's executable. Any
ideas how to do this?

I looked up some Win APIs but none to accomplish this task.

I noticed there is a .StartInfo.Work ingDirectory in the process object
but it is always empty. I would think that the working dir would be the
same as the EXE if not defined.
Aug 31 '06 #3
The only option I see in C# is
string AppPath = System.Windows. Forms.Applicati on.StartupPath;
MessageBox.Show (AppPath);

I think you can google and find better option if this doesn't work.
Regards,
Rajesh
Siva M wrote:
System.Diagnost ics.Process.Mai nModule.FileNam e

<wh*******@gmai l.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
Hi,
I need the directory of a running process or service's executable. Any
ideas how to do this?

I looked up some Win APIs but none to accomplish this task.

I noticed there is a .StartInfo.Work ingDirectory in the process object
but it is always empty. I would think that the working dir would be the
same as the EXE if not defined.
Aug 31 '06 #4
Rob
On 31 Aug 2006 09:33:54 -0700, wh*******@gmail .com wrote:
>Hi,
I need the directory of a running process or service's executable. Any
ideas how to do this?
The current process?
Process.GetCurr entProcess().Ma inModule.FileNa me;
Sep 1 '06 #5
Environment.Com mandLine has full path and exe name in it.
<wh*******@gmai l.comha scritto nel messaggio
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
Hi,
I need the directory of a running process or service's executable. Any
ideas how to do this?

I looked up some Win APIs but none to accomplish this task.

I noticed there is a .StartInfo.Work ingDirectory in the process object
but it is always empty. I would think that the working dir would be the
same as the EXE if not defined.

Sep 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6739
by: | last post by:
Hi, I have a Windows Service that uses a referenced dotnet-dll. In my dll I set some public string to a stringvalue that I get from reading a xml-file(my config file). It works fine if I use it in a vb-form. But since Windows Services ? executes? in windows\system32 I can´t locate my xml-config- file. I don´t want to set different...
1
3718
by: Theerachet Pratoommanee | last post by:
This is error message I've got. Any suggestion would be appreciated. Server Error in '/WebDirectory' Application. ---------------------------------------------------------------------------- ---- Access to the path "CreateFolder" is denied.
7
19610
by: Eric.Jones | last post by:
I've encountered a strange error with loading delimited files from a Samba (SMB) network drive, has anyone else seen this before? (Platform: WinXP Pro, UDB PE 8015, level 02060106, SAMPLE db) db2 load from M:\org1.del of del replace into org SQL3109N The utility is beginning to load data from file "M:\org1.del". SQL2036N The path for the...
2
3967
by: gordingin | last post by:
I need to get the path of a service in C#. Using C++, I can use QueryServiceConfig() but I wish not to use Interop if I dont have to, is there a way in C#? thanks Ralph
1
3981
by: Johan | last post by:
Hi all I'm trying to set the permissions of a file using WMI, and since i'm writing a windows service i want to use UNC paths doing this because the destination might not be a mapped path. I'we been looking around here at google and gotten the impression that it is not possible to use UNC paths when working with WMI, is that really so? Or...
3
7946
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images C:\Inetpub\wwwroot\RunReportASP is the directory of my virtual directory for my app. In it's properties I did check "Write" as a permission. What else...
7
19725
by: hufaunder | last post by:
I have a website that uses a web service that is located on the same machine. This webservice calls a program which in return modifies a file in c:\documents and Settings\All Users\Application Data\...'. Unfortunately, whenever the webservice is executed I get the following error message: Access to the path 'C:\Documents and Settings\All...
1
1957
by: =?Utf-8?B?Tko=?= | last post by:
Hi everyone, Every now and then I'm receiving the error posted below. I"m routing all my traffic through mod_proxy (apache) to my asp.net 2.0 (w2k3) machine. I can't reproduce this error and my site appears fine through my browser. I'm wondering if it is a search bot that is making these requests. Anyways, I can't find anything on google...
12
3695
by: Anil Gupte | last post by:
I wrote my Windows Service first as a regular Windows Exe because it is easier to debug. In that I used AppDir = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\")) ' Where this application Excutable sits Now, when I am converting it to a Service, what path can I use? Or can I specify a path in the...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.