Writing commands to cmd from VB.Net 2005

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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.
 
Back
Top