473,473 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Application.StartUpPath in a Windows service

Hi,

I want to get the application startup path of a windows service which is
available with Application.StartupPath in the System.Windows.Forms
namespace.

Since we can not use this namespace in a service, what is the best way to
get the same information that is the path of the EXE for the service?

Thank you for your help,

Mario

Nov 20 '05 #1
2 10705
* "Mario" <bm*@online.nospam> scripsit:
I want to get the application startup path of a windows service which is
available with Application.StartupPath in the System.Windows.Forms
namespace.


\\\
Imports System.IO
Imports System.Reflection
..
..
..
Private Function ApplicationPath() As String
Return _
Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)
End Function
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Thanks Herfried,

I will have to brush up on my research techniques... I did not look long
enough in the system.reflection class.

Mario

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> a écrit dans le
message de news:u5**************@tk2msftngp13.phx.gbl...
* "Mario" <bm*@online.nospam> scripsit:
I want to get the application startup path of a windows service which is
available with Application.StartupPath in the System.Windows.Forms
namespace.


\\\
Imports System.IO
Imports System.Reflection
.
.
.
Private Function ApplicationPath() As String
Return _
Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)
End Function
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3

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

Similar topics

3
by: Dmitry Akselrod | last post by:
Hello everyone, This is probably a very simple and stupid question, but I cannot seem to find the answer to it. How do I obtain the path of a windows service's executable file? The...
1
by: David B Stinson | last post by:
I have a C# windows service. How can I determine the start up path for the service? The default current directory when the service starts is \windows\system32. The Application.StartupPath for a...
5
by: Eranga | last post by:
In c# windows applicatiopns the Application.StartupPath can be used to find the path for the executable file. How can the same be found for a console application?(we can't use application because...
8
by: jcrouse | last post by:
I am trying to run a command from a command prompt using the shell command. Here is the syntax I want to execute: Shell(lblMameExePath.Text & " -listinfo >" & Application.StartupPath &...
1
by: Sean | last post by:
Hi I created a VB.NET console app. I try to use the Application.StartupPath() but got an error: Name 'Application' is not declared. Any idea? Thanks. Sean
3
by: hayworth | last post by:
I had some code to build the name of a file: ' Build the name of the XML config file. g_strFiles.strConfig = My.Computer.FileSystem.CombinePath(Application.StartupPath, "\Settings\Config...
2
by: Mark | last post by:
I just discovered that the Application object is not available in the Windows service application. Is there any way to access properties such as StartupPath in Windows service application? Thanks...
0
by: =?Utf-8?B?Sm9iIExvdA==?= | last post by:
I am using BulkLoad from .NET application as follows SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class obj = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class(); obj.ConnectionString =...
4
by: =?Utf-8?B?S2lt?= | last post by:
Hey All I know how to to get the service ( by RegistyKey and Registy) so I can start the Application by dobble ckich on the file, but how can I read (and save) the path to the file so I can save...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.