File location with Windows Services ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to specify where support files are located for a Windows
Service?

I would like to have my service write and read it's files to/from a
different location than Windows\System32.

I would also like to have this location changed based on the where the user
requests that myservice.exe is placed.

Comments?
 
Hi Mike,

It really depends on how you read the files, but you can probably always use
Assembly.GetExecutingAssembly().Location to determine the path where
myservice.exe resides.
 
Thanks very much for your assistance.

I found a way to do this. After the service is installed I have my service
application read the ImagePath entry from the Registry. I then use this to
read or write any files that are required by the service.

I still have to look into the suggestion made by Dmytro of using
"Assembly.GetExecutingAssembly().Location". Dmytro, thanks very much for the
response.
 
Back
Top