473,785 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

shell,console and standard input and output

Hi,

I would like to do this in VB Languague.

I have an executable file in DOS mode. This executable returns informations
and display them to the DOS window. Unfortunately, I have to process theses
informations.
The way to do that, is to redirect standard input and output, insn't it ?
This is possible in C++ language, but I cannot make any line in this
language.

Then I have tried with the Console class but this class don't execute
programs like the Shell() function ! The line I tried is :
console.write(" Exename") and with the Console.read () method, I obtain no
data !

Can anyone tell me if I did wrong, or if it's simply possible !

thanks for your help
Nov 20 '05 #1
5 4228
Cor
Hi Chrisophe,

Why not write it to disk and than read it back, more simple I cannot
imaging?

Just my thought.

Cor
I have an executable file in DOS mode. This executable returns informations and display them to the DOS window. Unfortunately, I have to process theses informations.
The way to do that, is to redirect standard input and output, insn't it ?
This is possible in C++ language, but I cannot make any line in this
language.

Then I have tried with the Console class but this class don't execute
programs like the Shell() function ! The line I tried is :
console.write(" Exename") and with the Console.read () method, I obtain no
data !

Nov 20 '05 #2
Because this program is interactive like ftp in DOS mode, you have to put
commands and then you get the response. This is unfeasible with external
file.

"Cor" <no*@non.com> a écrit dans le message de
news:OL******** *******@TK2MSFT NGP10.phx.gbl.. .
Hi Chrisophe,

Why not write it to disk and than read it back, more simple I cannot
imaging?

Just my thought.

Cor
I have an executable file in DOS mode. This executable returns

informations
and display them to the DOS window. Unfortunately, I have to process

theses
informations.
The way to do that, is to redirect standard input and output, insn't it ? This is possible in C++ language, but I cannot make any line in this
language.

Then I have tried with the Console class but this class don't execute
programs like the Shell() function ! The line I tried is :
console.write(" Exename") and with the Console.read () method, I obtain no data !


Nov 20 '05 #3
> more simple I cannot imaging?

I can :-)

take a look at
System.Diagnost ics.Process

look at the StandardOutput property
in the class reference you have an example how to get the process output
very easy
Dominique

"Cor" <no*@non.com> wrote in message
news:OL******** *******@TK2MSFT NGP10.phx.gbl.. .
Hi Chrisophe,

Why not write it to disk and than read it back, more simple I cannot
imaging?

Just my thought.

Cor
I have an executable file in DOS mode. This executable returns

informations
and display them to the DOS window. Unfortunately, I have to process

theses
informations.
The way to do that, is to redirect standard input and output, insn't it ? This is possible in C++ language, but I cannot make any line in this
language.

Then I have tried with the Console class but this class don't execute
programs like the Shell() function ! The line I tried is :
console.write(" Exename") and with the Console.read () method, I obtain no data !


Nov 20 '05 #4
Thanks for your help, but perhaps I'm stupid.
I've tried with the ftp.exe as executable, so I can have interaction.
By trying this piece of code in a Console application, the variable strOut
is empty !

Sub Main()
Const Path = "C:\WINNT\Syste m32\ftp.exe"

Const Args = "hostname"

Dim P As New Process

Dim strOut As String

P.StartInfo.Use ShellExecute = False

P.StartInfo.Red irectStandardOu tput = True

P.Start(Path, Args)

strOut = P.StandardOutpu t.ReadToEnd()

Debug.Write(str Out)

P.WaitForExit()

P.Close()

End Sub

"Dominique Vandensteen" <domi.vds_inser t@tralala_tenfo rce.com> a écrit dans
le message de news:OM******** ********@TK2MSF TNGP09.phx.gbl. ..
more simple I cannot imaging?
I can :-)

take a look at
System.Diagnost ics.Process

look at the StandardOutput property
in the class reference you have an example how to get the process output
very easy
Dominique

"Cor" <no*@non.com> wrote in message
news:OL******** *******@TK2MSFT NGP10.phx.gbl.. .
Hi Chrisophe,

Why not write it to disk and than read it back, more simple I cannot
imaging?

Just my thought.

Cor
I have an executable file in DOS mode. This executable returns

informations
and display them to the DOS window. Unfortunately, I have to process

theses
informations.
The way to do that, is to redirect standard input and output, insn't
it ? This is possible in C++ language, but I cannot make any line in this
language.

Then I have tried with the Console class but this class don't execute
programs like the Shell() function ! The line I tried is :
console.write(" Exename") and with the Console.read () method, I obtain no data !



Nov 20 '05 #5
* "Christophe HELFER" <ch************ ***@ires.in2p3. fr> scripsit:
I have an executable file in DOS mode. This executable returns informations
and display them to the DOS window. Unfortunately, I have to process theses
informations.
The way to do that, is to redirect standard input and output, insn't it ?


<http://www.mvps.org/dotnet/dotnet/samples/miscsamples/downloads/RedirectConsole .zip>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2213
by: E.U. | last post by:
Hello, I need to program grep (like the one UNIX has but more simple) For example if the programs name(the grep I will write) is p3 then if I write in shell p3 story.txt word The output should be all lines where the word "word" appears. The problem is that I am suppose to use this command in shell as well
4
8741
by: Bill Cohagan | last post by:
I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I want to support the "<" and ">" redirection syntax. The obvious way to do this is by using the static Console type properties, In and Out. When trying to debug the app in the IDE however, this doesn't appear to work. I've edited the project properties and added the necessary text to the "command...
7
2970
by: ~toki | last post by:
I have a full work app (server and client) that talk between two executables trought Console.WriteLine(); & Console.ReadLine(); I have the source code of the server. I need to make the client. To do this i have Console.WriteLine("Hi server"); while (true)
5
11258
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough to avoid the overhead of writing to the console if it is not visible, eg I am running inside a WinForm application. thanks
2
2510
by: JezB | last post by:
I'm compiling an old C program within Visual Studio to give me the advantages of debugging within this environment. I'm building it as a Console application using C++ as the language. It compiles and runs fine, but if start debugging from within Visual Studio the standard output does not seem to go anywhere. Standard output within my C program is via printf commands. I dont want to start embedding Debug or Console statements since I want...
12
3757
by: Jarod_24 | last post by:
I got a project called "Forms" that hold some forms and stuff in my solution. A argument at startup defines wether to use a From or Console. My plan was to create a myConsole class that would also allow my application to display a Console, but i don't seem to be allowed to do this. I don't see any References that i need to add, so how do i do this.
0
1519
by: F.C. | last post by:
Hello, :) I'm currently writing a frontend for a console application using VB .net. I'm using the traditional Process creation to launch it and redirect input and output to my windows application, something like this : myProcess.StartInfo.UseShellExecute = False myProcess.StartInfo.CreateNoWindow = True myProcess.StartInfo.RedirectStandardInput = True myProcess.StartInfo.RedirectStandardOutput = True
4
15079
by: Kevin Mansel via .NET 247 | last post by:
Ok, basically this is my problem. I'm building a console app tocall a dos program. So i'm using the Shell command to call theprogram, now depending on what happens, I want to read theoutput that this program returns. I'm just missing the stepshere. I know that I can set the Shell command to an integer,but this only returns a 0 to me telling me that it executed, notwhat is being returned to the console by that application. Isthere a way to...
4
2382
by: Anastasios Hatzis | last post by:
I'm looking for a pattern where different client implementations can use the same commands of some fictive tool ("foo") by accessing some kind of API. Actually I have the need for such pattern for my own tool (http://openswarm.sourceforge.net). I already started restructuring my code to separate the actual command implementations from the command-line scripts (which is optparser-based now) and have some ideas how to proceed. But probably...
0
9645
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
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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
10090
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
9949
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
8971
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...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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.