473,395 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Windows Service "Start In" Folder

Is there a way to set the "start in" folder for a windows service?

I am running under the Local System account, and the start in folder
seems to be "c:\windows\system32". I use some relative filenames in my
application and would really like the start in folder to be something
more like "c:\apps\myservice".

I've looked at the ServiceInstaller class and ServiceProcessInstaller
class but they don't seem to have this option.

--Brian
Jun 1 '06 #1
2 2858
Brian,

Instead of looking at the start in folder, why not look for the location
of the assembly using reflection, then use that for your relative file
paths?

Either that, or send the path to your directory in the parameters
textbox on the first page of the properties for the service.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Brian" <no@email.com> wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
Is there a way to set the "start in" folder for a windows service?

I am running under the Local System account, and the start in folder seems
to be "c:\windows\system32". I use some relative filenames in my
application and would really like the start in folder to be something more
like "c:\apps\myservice".

I've looked at the ServiceInstaller class and ServiceProcessInstaller
class but they don't seem to have this option.

--Brian

Jun 1 '06 #2
Nicholas Paldino [.NET/C# MVP] wrote:
Brian,

Instead of looking at the start in folder, why not look for the location
of the assembly using reflection, then use that for your relative file
paths?

Either that, or send the path to your directory in the parameters
textbox on the first page of the properties for the service.

Hope this helps.


Yes, that seems to be a good solution.

I'll use reflection once at the start of my service to get the
assembly's folder, and then use
System.IO.Directory.SetCurrentDirectory() so the rest of my application
can use relative paths.

--Brian
Jun 1 '06 #3

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

Similar topics

3
by: Mensan | last post by:
I am trying to compute the differnece between two dwords in visual basic and keep getting the wrong value being computed. I have the following structure defind: Public Type HighLowQuote...
2
by: AZSEEK | last post by:
I created a Windows Service in VB.Net and I tried using the InstallUtil and I keep getting this error message -- please help Exception occurred while initializing the installation:...
4
by: yaipa | last post by:
All, I've been asked by my boss to put an Icon in WinXP's "My Computer" for a utility we use around the shop. My tool of choice is of course Python and therefore what I am using to attempt my...
2
by: Sooha Park Lee | last post by:
I would like to compare two "double" numbers. To overcome round-off error, I am using the following strategy: rounding each number and try to convert it into interger by multiplying 10E6. One...
1
by: Vimal | last post by:
Hi, Can any one tell me how to write a msmq listener as a windows service in C#? Thanks in Advance, Vimal
3
by: Dean Slindee | last post by:
The code below is being used to launch WinWord.exe from a VB.NET program. Word launches, but displays this error message: "Word has experienced an error trying to open the file. Try these...
1
by: Mahita | last post by:
Hi, I am coding a Windows Service in which I am using the "OnCreated" event of FileSystemWatcher class to do some processing when a new file is created in a particular folder. However I have...
4
by: fran7 | last post by:
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to a javascript function so the height needs to be in...
2
by: iprogrammer | last post by:
i have created the default web service "hello world"....in folder website5/service.asmx..now when i access the service from my localhost using the web reference...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.