Sep 15, 2009

Change Current Directory To Execute External EXE File

Sometimes you need to trigger an exe file not within your current application directory.
You may change your current directory ( one of the easiest method ).
Yet you have to change back your directory after you done the execution process.

//Set the current directory.
Directory.SetCurrentDirectory(my-dir-variable);

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "WINWORD.EXE";
startInfo.Arguments = my-file-name-variable;
 
Process.Start(startInfo);

Bookmark and Share

No comments:

Post a Comment