473,398 Members | 2,165 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,398 software developers and data experts.

How to run and communicate a DOS program file in a VB.NET program?


Hello any expert,

I has a vb.net program.
For user requirement, I need to run and communicate an old DOS execution
file.
But, how to run and communicate a DOS program in a VB.NET program?
Should I use the Process or Console class? How to do that?

For example,
If this DOS program name as "pick.exe".

In DOS SHELL, user run the pick.exe then type "command1" and wait to
response1

message.
type "command2" and .
When user receives the response1 message then type "command2" and wait to

receive response2 message, later, user closes the DOS SHELL window.

welcome to pick.exe v1.23
-------------------------
command1
..........
response1 message
command2
..........
response2 message
Thank you very much.
Joe
Nov 26 '06 #1
9 2973
"tsung-yu" <ts******@hotmail.comschrieb:
For user requirement, I need to run and communicate an old DOS execution
file.
But, how to run and communicate a DOS program in a VB.NET program?
Should I use the Process or Console class? How to do that?
See:

<URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 26 '06 #2
OHM
Here is an example, of how to write and get input from the console program.

Module Module1

Sub Main()

Dim myNum As Double

Do While getNumber(myNum)

myNum *= 10
Console.WriteLine("That number multiplied by 10 = " &
myNum.ToString)

Loop

Console.WriteLine("Thank you for using the calculator!")
Console.ReadLine()

End Sub

Function getNumber(ByRef myNum As Double) As Boolean
Dim myVal As String
Console.WriteLine("Please enter a value between 1 and 10 ")
myVal = Console.ReadLine
If Not IsNumeric(myVal) Then
Console.WriteLine("That was NOT a number !")
Return False
Else
myNum = CType(myVal, Double)
Return True
End If

End Function

End Module

End Module
"tsung-yu" <ts******@hotmail.comwrote in message
news:eP**************@TK2MSFTNGP03.phx.gbl...
>
Hello any expert,

I has a vb.net program.
For user requirement, I need to run and communicate an old DOS execution
file.
But, how to run and communicate a DOS program in a VB.NET program?
Should I use the Process or Console class? How to do that?

For example,
If this DOS program name as "pick.exe".

In DOS SHELL, user run the pick.exe then type "command1" and wait to
response1

message.
type "command2" and .
When user receives the response1 message then type "command2" and wait to

receive response2 message, later, user closes the DOS SHELL window.

welcome to pick.exe v1.23
-------------------------
command1
.........
response1 message
command2
.........
response2 message
Thank you very much.
Joe


Nov 26 '06 #3
you can't communicate with DOS; DOS is only on Windows 95/98/Me and
none of those support VB 2005.

-Aaron

OHM wrote:
Here is an example, of how to write and get input from the console program.

Module Module1

Sub Main()

Dim myNum As Double

Do While getNumber(myNum)

myNum *= 10
Console.WriteLine("That number multiplied by 10 = " &
myNum.ToString)

Loop

Console.WriteLine("Thank you for using the calculator!")
Console.ReadLine()

End Sub

Function getNumber(ByRef myNum As Double) As Boolean
Dim myVal As String
Console.WriteLine("Please enter a value between 1 and 10 ")
myVal = Console.ReadLine
If Not IsNumeric(myVal) Then
Console.WriteLine("That was NOT a number !")
Return False
Else
myNum = CType(myVal, Double)
Return True
End If

End Function

End Module

End Module
"tsung-yu" <ts******@hotmail.comwrote in message
news:eP**************@TK2MSFTNGP03.phx.gbl...

Hello any expert,

I has a vb.net program.
For user requirement, I need to run and communicate an old DOS execution
file.
But, how to run and communicate a DOS program in a VB.NET program?
Should I use the Process or Console class? How to do that?

For example,
If this DOS program name as "pick.exe".

In DOS SHELL, user run the pick.exe then type "command1" and wait to
response1

message.
type "command2" and .
When user receives the response1 message then type "command2" and wait to

receive response2 message, later, user closes the DOS SHELL window.

welcome to pick.exe v1.23
-------------------------
command1
.........
response1 message
command2
.........
response2 message
Thank you very much.
Joe
Nov 26 '06 #4
aa*********@gmail.com wrote:
you can't communicate with DOS; DOS is only on Windows 95/98/Me and
none of those support VB 2005.
While DOS may not exist any more, it is fairly simple to communicate
with a *console* application using the Process class and by redirecting
standard input and output as Herfried and OHM suggested.

And .Net 2.0 apps will run on Win 98, Win Me and higher. Only Win 95
is not supported. Taken from Microsoft.com:

Supported Operating Systems: Windows 2000 Service Pack 3; Windows 98;
Windows 98 Second Edition; Windows ME; Windows Server 2003; Windows XP
Service Pack 2

Chris

Nov 27 '06 #5
of course, VB 2002, 2003 and 2005 are not supported on _VISTA_ right?

I heard that VB is going away

Larry Linson, Jr
Chris Dunaway wrote:
aa*********@gmail.com wrote:
you can't communicate with DOS; DOS is only on Windows 95/98/Me and
none of those support VB 2005.

While DOS may not exist any more, it is fairly simple to communicate
with a *console* application using the Process class and by redirecting
standard input and output as Herfried and OHM suggested.

And .Net 2.0 apps will run on Win 98, Win Me and higher. Only Win 95
is not supported. Taken from Microsoft.com:

Supported Operating Systems: Windows 2000 Service Pack 3; Windows 98;
Windows 98 Second Edition; Windows ME; Windows Server 2003; Windows XP
Service Pack 2

Chris
Nov 27 '06 #6
and that doesn't include NT which is even a worse sin than not
including '95


Chris Dunaway wrote:
aa*********@gmail.com wrote:
you can't communicate with DOS; DOS is only on Windows 95/98/Me and
none of those support VB 2005.

While DOS may not exist any more, it is fairly simple to communicate
with a *console* application using the Process class and by redirecting
standard input and output as Herfried and OHM suggested.

And .Net 2.0 apps will run on Win 98, Win Me and higher. Only Win 95
is not supported. Taken from Microsoft.com:

Supported Operating Systems: Windows 2000 Service Pack 3; Windows 98;
Windows 98 Second Edition; Windows ME; Windows Server 2003; Windows XP
Service Pack 2

Chris
Nov 27 '06 #7
and I want a reference for that; I dont believe that .NET 2.0 supports
windows 98

you sure can't install VB 2005 Express Edition on Windows 98 can you?

-Aaron


Chris Dunaway wrote:
aa*********@gmail.com wrote:
you can't communicate with DOS; DOS is only on Windows 95/98/Me and
none of those support VB 2005.

While DOS may not exist any more, it is fairly simple to communicate
with a *console* application using the Process class and by redirecting
standard input and output as Herfried and OHM suggested.

And .Net 2.0 apps will run on Win 98, Win Me and higher. Only Win 95
is not supported. Taken from Microsoft.com:

Supported Operating Systems: Windows 2000 Service Pack 3; Windows 98;
Windows 98 Second Edition; Windows ME; Windows Server 2003; Windows XP
Service Pack 2

Chris
Nov 27 '06 #8
aa*********@gmail.com wrote:
and I want a reference for that; I dont believe that .NET 2.0 supports
windows 98
http://www.microsoft.com/downloads/d...displaylang=en
>
you sure can't install VB 2005 Express Edition on Windows 98 can you?
I never said you could. VS 2005 and it's variants are only supported
on Win 2000 and higher. But the .Net framework is supported as I said
earlier. Obviously, using XP or 2000 specific features will render the
app unusable on Win 98.

Nov 27 '06 #9
so sorry this is what was hanging me up
o Windows Installer 3.0 (except for Windows 98/ME, which require
Windows Installer 2.0 or later). Windows Installer 3.1 or later is
recommended.

well if 3.0 isn't a requirement then why do they make me install it
before installing SQL 2005?

these fuckers need to learn how to SIMPLIFY
if they had just done as they said; and discontinued the 9x line with
the release of Windows 2000-- then maybe things wouldn't be sooo
complex

it's just laughable now

Chris Dunaway wrote:
aa*********@gmail.com wrote:
and I want a reference for that; I dont believe that .NET 2.0 supports
windows 98

http://www.microsoft.com/downloads/d...displaylang=en

you sure can't install VB 2005 Express Edition on Windows 98 can you?

I never said you could. VS 2005 and it's variants are only supported
on Win 2000 and higher. But the .Net framework is supported as I said
earlier. Obviously, using XP or 2000 specific features will render the
app unusable on Win 98.
Nov 27 '06 #10

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

Similar topics

2
by: kamarudin samsudin | last post by:
Hi all, Im new to linux and very very new to python. But i have to write a program to communicate with a devide. The device will send a data after i send something to it. Any suggestion and...
1
by: Edward C. Jones | last post by:
I have a program named "octave" (a Matlab clone). It runs in a terminal, types a prompt and waits for the user to type something. If I try # Run octave. oct = subprocess.Popen("octave",...
8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
5
by: hlam | last post by:
I am developing a VB application using Visual Studio.NET and I need to communicate with a C program (supplying it with inputs and receiving output from it). What is the best way to do this? ...
3
by: Jay Patel | last post by:
Hello, I need to write visual basic.net code to interface with a Mettler Toledo Shipping Scale that interfaces with a PC via USB or a serial port. I have seen example code on how to communicate...
3
by: I. Myself | last post by:
I can't get this to work: # commer.py - to test communication with other process from popen2 import popen2 (child_stdout, child_stdin) = popen2("commer.exe") print "Got here 1" line =...
6
by: Mike9900 | last post by:
How can I connect my .NET app which use remoting to communicate over internet, 2 instance of the same app? My app is already done using .NET Remoting. I am wondering if to change them to WCF or...
0
by: Ajith | last post by:
Hi All, I am implementing a TCP/IP Socket programming using POSIX Standard. I have my server up and running. one of the client which needs to communicate with server - has been implemented using...
8
by: rdabane | last post by:
I'm trying to perform following type of operation from inside a python script. 1. Open an application shell (basically a tcl ) 2. Run some commands on that shell and get outputs from each command...
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
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
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
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,...
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...
0
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,...
0
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...

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.