By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,773 Members | 1,779 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,773 IT Pros & Developers. It's quick & easy.

Process.StandardInput.WriteLine not working under Vista?

P: n/a
The following code used to work. It starts up notepad and types a few lines.
What am I doing wrong? I'm using VB.NET 2005 under Vista. It starts notepad
okay, but it can't 'type' into it.
'demonstrate "typing" into notepad
Dim psiProcessStartInfo As New ProcessStartInfo
With psiProcessStartInfo
.Arguments = "" 'command line arguments
.CreateNoWindow = False
.ErrorDialog = False
.FileName = "notepad.exe"
.LoadUserProfile = False
.RedirectStandardError = False
.RedirectStandardInput = True
.RedirectStandardOutput = False
.UseShellExecute = False 'this must be false for
input/output/error redirection
.WorkingDirectory = ""
End With
Using prc As Process = Process.Start(psiProcessStartInfo)
MsgBox("")
prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
End Using

--
David Streeter
Synchrotech Software
Sydney Australia
Oct 23 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Oct 22, 8:32*pm, SurturZ <surt...@newsgroup.nospamwrote:
The following code used to work. It starts up notepad and types a few lines.
What am I doing wrong? I'm using VB.NET 2005 under Vista. It starts notepad
okay, but it can't 'type' into it.

* * * * 'demonstrate "typing" into notepad
* * * * Dim psiProcessStartInfo As New ProcessStartInfo
* * * * With psiProcessStartInfo
* * * * * * .Arguments = "" 'command line arguments
* * * * * * .CreateNoWindow = False
* * * * * * .ErrorDialog = False
* * * * * * .FileName = "notepad.exe"
* * * * * * .LoadUserProfile = False
* * * * * * .RedirectStandardError = False
* * * * * * .RedirectStandardInput = True
* * * * * * .RedirectStandardOutput = False
* * * * * * .UseShellExecute = False 'this must be false for
input/output/error redirection
* * * * * * .WorkingDirectory = ""
* * * * End With
* * * * Using prc As Process = Process.Start(psiProcessStartInfo)
* * * * * * MsgBox("")
* * * * * * prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
* * * * * * prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
* * * * * * prc.StandardInput.WriteLine("This line added by ProcessMgmtDemo")
* * * * End Using

--
David Streeter
Synchrotech Software
Sydney Australia
Why are you trying to open and manipulate Notepad instead of just
writing to a file and then opening it in Notepad?

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Oct 23 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.