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

Writing commands to cmd from VB.Net 2005

P: n/a
Hi everyone. I hope that someone can help me.

I'm trying to start a command prompt from vb.net 2005 with
newProc.Start("cmd.exe"). This works but then I want to write commands to
the process. I have tried

newProc.StartInfo.FileName = "cmd.exe"
newProc.StartInfo.UseShellExecute = False
newProc.StartInfo.redirectStandardInput = True
newProc.Start()
newProc.StandardInput.WriteLine("cd testmap")

This does'nt work and when I use the redirectStandardInput the cmd-window
disapear.
Nov 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Nettan" <Ne****@discussions.microsoft.comwrote in message
news:89**********************************@microsof t.com...
Hi everyone. I hope that someone can help me.

I'm trying to start a command prompt from vb.net 2005 with
newProc.Start("cmd.exe"). This works but then I want to write commands to
the process. I have tried

newProc.StartInfo.FileName = "cmd.exe"
newProc.StartInfo.UseShellExecute = False
newProc.StartInfo.redirectStandardInput = True
newProc.Start()
newProc.StandardInput.WriteLine("cd testmap")

This does'nt work and when I use the redirectStandardInput the cmd-window
disapear.
Sorry I don't know the specifics of how to code to CMD, but my first thought
was to write out a batch file and execute that instead of redirecting
standard input.
Nov 7 '06 #2

P: n/a
Thanks, I tried with a batch-file instead and it works fine.

"Robinson" wrote:
"Nettan" <Ne****@discussions.microsoft.comwrote in message
news:89**********************************@microsof t.com...
Hi everyone. I hope that someone can help me.

I'm trying to start a command prompt from vb.net 2005 with
newProc.Start("cmd.exe"). This works but then I want to write commands to
the process. I have tried

newProc.StartInfo.FileName = "cmd.exe"
newProc.StartInfo.UseShellExecute = False
newProc.StartInfo.redirectStandardInput = True
newProc.Start()
newProc.StandardInput.WriteLine("cd testmap")

This does'nt work and when I use the redirectStandardInput the cmd-window
disapear.

Sorry I don't know the specifics of how to code to CMD, but my first thought
was to write out a batch file and execute that instead of redirecting
standard input.
Nov 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.