views:

103

answers:

1

I programmed (C# .Net 3.5) a process to start when windows (XP) starts. This process uses other files in the same folder as itself. Moreover, it starts another process, again located in the same folder. However, it seems like the process cannot find the files in the same folder (they are there). Instead, it looks in "C:\Documents and Setting\User" folder. Whenever, all the files are in this folder it starts properly but NOT when they are in a different folder.

The process is made to start with Windows start-up by registering it in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

Thank you for your answers...

A: 

You may try setting the working directory when you start your process:

Directory.SetCurrentDirectory(
    Path.GetDirectoryName(
        Assembly.GetExecutingAssembly().Location
    )
);

If you later try accessing a file in the same directory as the process executable by specifying a relative path it should be able to find it.

Darin Dimitrov
Thank you Darin,This worked like a charm.
boston_programmer