Use registry to startup a program, and also change the current working directory?

You can register your application under next registry key (like this does Reg2Run tool)

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\example.exe

@="c:\example\example.exe"
Path="c:\AnotherPath"

So System.Diagnostics.Run("example.exe"); will launch your application with specified working path.

Or another way: write a launcher using C#. You can do the same using a PowerShell cmdlet.

var info = new System.Diagnostics.ProcessStartInfo(@"c:\example\example.exe", "-someargument")
{
    WorkingDirectory = @"c:\AnotherPath"
};
System.Diagnostics.Process.Start(info);

Leave a Comment