Startup folder in .NET

B

bob laughland

Hi All,

Within our application is some configuration which allows the user to
add a link into the startup folder. That of course will mean our
application would then start automatically when windows starts.

We are using .NET 3.5 C#. So I am using this C# code to get the
startup folder path,

Environment.GetFolderPath(Environment.SpecialFolder.Startup)

That works on my local development machines (windows 2008 server and
vista). But it does not work on our build server, what I mean is it
actually returns an empty string on our build server.

It used to work on our old build server (windows 2003) but when I
rebuilt our build server using windows 2008 it didn't work.

Any ideas? Is it the case that when the startup folder has not been
used before something within the OS has not been initialised?
 
P

Phil Wilson

This kind of thing depends on the account you're running with (I don't think
SYSTEM has a profile) and whether you're impersonating (which by default
does not load registry hive data for that user). If it's an account which
has never interactively logged on then maybe those folders have never been
set up. It will also depend on whether anyone actually logs on or not. The
Startup folder is not run when Windows starts (for which you need a service)
but when logon occurs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top