473,503 Members | 10,322 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 4215
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***************@TK2MSFTNGP10.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.Diagnostics.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***************@TK2MSFTNGP10.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\System32\ftp.exe"

Const Args = "hostname"

Dim P As New Process

Dim strOut As String

P.StartInfo.UseShellExecute = False

P.StartInfo.RedirectStandardOutput = True

P.Start(Path, Args)

strOut = P.StandardOutput.ReadToEnd()

Debug.Write(strOut)

P.WaitForExit()

P.Close()

End Sub

"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> a écrit dans
le message de news:OM****************@TK2MSFTNGP09.phx.gbl...
more simple I cannot imaging?
I can :-)

take a look at
System.Diagnostics.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***************@TK2MSFTNGP10.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
2199
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...
4
8718
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....
7
2949
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....
5
11191
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...
2
2498
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...
12
3729
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...
0
1504
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...
4
15037
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...
4
2361
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...
0
7095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7294
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,...
1
7015
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...
0
7470
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...
1
5026
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...
0
3183
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...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
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 ...
0
403
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...

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.