You're currently passing the full pathname in the arguments, when I suspect you want to pass it as the filename. For example:
FileName = Path.Combine(Environment.SystemDirectory, "netsh.exe"),
Arguments = "wlan start hostednetwork"
For example, this short but complete program doesn't throw any exceptions - I don't know whether it does what you want, but it doesn't fail with the exception you described:
using System;
using System.Diagnostics;
using System.IO;
class Test
{
static void Main()
{
ProcessStartInfo procInfo = new ProcessStartInfo
{
WorkingDirectory = Path.GetPathRoot(Environment.SystemDirectory),
FileName = Path.Combine(Environment.SystemDirectory, "netsh.exe"),
Arguments = "wlan start hostednetwork",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process proc = Process.Start(procInfo);
proc.WaitForExit();
}
}
(Note how the code becomes less cluttered when you take advantage of using
directives instead of using fully-qualified names, by the way.)