65.9K
CodeProject is changing. Read more.
Home

Running a(ny) shell command using C#

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Feb 12, 2011

CPOL
viewsIcon

9580

Something I only found out about recently:There's a better alternative than using "cmd start...".One should use the following method:[System.Runtime.InteropServices.DllImport("shell32. dll")]private static extern long ShellExecute(Int32 hWnd, string lpOperation,string lpFile, string...

Something I only found out about recently: There's a better alternative than using "cmd start...". One should use the following method:
[System.Runtime.InteropServices.DllImport("shell32. dll")]
private static extern long ShellExecute(Int32 hWnd, string lpOperation,
string lpFile, string lpParameters, string lpDirectory, long nShowCmd);
This method is used according to what's written here[^]. If it helps, there's a guy who gave a good example of the usage (although it's written in C) in here[^].