473,699 Members | 3,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.StartIn fo.FileName = "cmd.exe"
newProc.StartIn fo.UseShellExec ute = False
newProc.StartIn fo.redirectStan dardInput = True
newProc.Start()
newProc.Standar dInput.WriteLin e("cd testmap")

This does'nt work and when I use the redirectStandar dInput the cmd-window
disapear.
Nov 7 '06 #1
2 1743
"Nettan" <Ne****@discuss ions.microsoft. comwrote in message
news:89******** *************** ***********@mic rosoft.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.StartIn fo.FileName = "cmd.exe"
newProc.StartIn fo.UseShellExec ute = False
newProc.StartIn fo.redirectStan dardInput = True
newProc.Start()
newProc.Standar dInput.WriteLin e("cd testmap")

This does'nt work and when I use the redirectStandar dInput 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****@discuss ions.microsoft. comwrote in message
news:89******** *************** ***********@mic rosoft.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.StartIn fo.FileName = "cmd.exe"
newProc.StartIn fo.UseShellExec ute = False
newProc.StartIn fo.redirectStan dardInput = True
newProc.Start()
newProc.Standar dInput.WriteLin e("cd testmap")

This does'nt work and when I use the redirectStandar dInput 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
1502
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 have difficulty doing this. My code doesn't need to be super-modular (I don't need functions that can be used in dozens of different programs). So, my functions don't tend to be portbale and can sometimes span one, or perhaps two pages. Is this...
5
1144
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
2052
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 interpreters. Are there any tools or good examples to follow for writing a bytecode interpreter? I am already aware of opcode.py and other modules in
1
2140
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 from gear to a logfile. The problem is that gear uses terminal control commands to create a nice commandline interface. I can filter out all non printable characters to get something I can put in my logfile, but this leaves a lot of the terminal...
12
5136
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 Order by ScreenName;Select * from Functions" How can I fix this problem. Any help is greatly appreciated. Selva
28
10262
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 appropriate based on your method names . the GridView has OnRowCommand="GridView1_RowCommand" in the aspx. my problem is that the RowCommand event is firing twice (95% of the time) on the page. the other 5% it only fires once. there's no
0
1502
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 command quickly. For example, I want to creata a script and run that script on the telnet window. For simpliciy lets say I would like to list directory contents 2 times in a row. I want to process "dir" two times. So, via code I send the dir...
5
1217
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 the code. Is there a good way to write the SQL so it remains neat, clear, readable and manageable? Also, being new to VS 2005, is there a way in which SQL commands can be tested in the Query browser and then 'parcelled up' automatiallt as...
0
1246
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 http://xahlee.org/emacs/elisp_perl_wrapper.html plain text version follows. ------------------------------------- Elisp Wrapper For Perl Scripts
0
8706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9055
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8947
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8902
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7787
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4392
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3076
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2016
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.