I want to open notepad with CMD, using C# but the path has a space in it. I know that there are a lot of questions similar to this, but I couldn't get any of those solutions to work with my example. I do not know why. If anyone wants to help, it would be greatly appreciated.
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = @"/C START ""C:\Users\Dale\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\notepad.exe""";
process.StartInfo = startInfo;
process.Start();
There is no error message, but nothing happens in the command prompt, and notepad doesn't open. Another issue is that the command prompt is visible even though I added
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;