Writing commands to cmd from VB.Net 2005

G

Guest

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.
 
R

Robinson

Nettan said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top