G
Guest
I'm trying to start a process, notepad, where I want write in some text before Notepad comes up on the screen
Obviously I don't understand how to do it
My code is
ProcessStartInfo startInfo = new ProcessStartInfo("Notepad.exe")
startInfo.WindowStyle = ProcessWindowStyle.Minimized
startInfo.UseShellExecute = false
startInfo.RedirectStandardInput = true
StreamWriter npin
Process p = new Process()
p.StartInfo = startInfo
npin = p.StandardInput
npin.WriteLine("Hej och hopp!")
p.Start()
When I run it I get the exception below! Is this a bug
An unhandled exception of type 'System.InvalidOperationException' occurred in system.dl
Additional information: StandardIn has not been redirected
Obviously I don't understand how to do it
My code is
ProcessStartInfo startInfo = new ProcessStartInfo("Notepad.exe")
startInfo.WindowStyle = ProcessWindowStyle.Minimized
startInfo.UseShellExecute = false
startInfo.RedirectStandardInput = true
StreamWriter npin
Process p = new Process()
p.StartInfo = startInfo
npin = p.StandardInput
npin.WriteLine("Hej och hopp!")
p.Start()
When I run it I get the exception below! Is this a bug
An unhandled exception of type 'System.InvalidOperationException' occurred in system.dl
Additional information: StandardIn has not been redirected