473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Writing commands to cmd from VB.Net 2005

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
2 1731
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Bart Nessux | last post by:
I understand that most people write functions to reuse code, no? So, I assume it would be better to write functions that are very specific, as opposed to those that are more generic. However, I...
5
by: alexrait1 | last post by:
Do something useful... (at least for me) For instance I need a gtk frontend for pgp. So here you can have an opportunity to learn both pyGTK and pgp. A lot of python code... :)
1
by: Jonathan Fine | last post by:
I'm writing some routines for handling dvi files. In case you didn't know, these are TeX's typeset output. These are binary files containing opcodes. I wish to write one or more dvi opcode...
1
by: Adriaan Renting | last post by:
I have the problem that I need to interact with a CD/DVD burning program called gear. I do this by running it in a pseudo terminal. I also need to log what I'm doing, so I copy all output I get...
12
by: Selva Chinnasamy | last post by:
Hi I am using batch commands against Ms-Access and getting an error Message "Characters found after end of SQL statement." String Here is my sql Dim str_screens As String = "Select * from Screens...
28
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when...
0
by: knowthediff | last post by:
Hello, I have a VS 2005 windows form app that I am creating. It uses Async socket to telnet which sends and receives commands. Everything seems to be working fine until I attempt to process a...
5
by: David++ | last post by:
Hello, Just wondering how you all deal with writing large SQL strings when coding database functionailty. Some of the SQL strings can get quite long and it looks a bit messy and hard to read in...
0
by: xahlee | last post by:
Here's a little tutorial that lets you write emacs commands for processing the current text selection in emacs in your favorite lang. Elisp Wrapper For Perl Scripts...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.