473,804 Members | 3,271 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2996
"tsung-yu" <ts******@hotma il.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.WriteLi ne("That number multiplied by 10 = " &
myNum.ToString)

Loop

Console.WriteLi ne("Thank you for using the calculator!")
Console.ReadLin e()

End Sub

Function getNumber(ByRef myNum As Double) As Boolean
Dim myVal As String
Console.WriteLi ne("Please enter a value between 1 and 10 ")
myVal = Console.ReadLin e
If Not IsNumeric(myVal ) Then
Console.WriteLi ne("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******@hotma il.comwrote in message
news:eP******** ******@TK2MSFTN GP03.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.WriteLi ne("That number multiplied by 10 = " &
myNum.ToString)

Loop

Console.WriteLi ne("Thank you for using the calculator!")
Console.ReadLin e()

End Sub

Function getNumber(ByRef myNum As Double) As Boolean
Dim myVal As String
Console.WriteLi ne("Please enter a value between 1 and 10 ")
myVal = Console.ReadLin e
If Not IsNumeric(myVal ) Then
Console.WriteLi ne("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******@hotma il.comwrote in message
news:eP******** ******@TK2MSFTN GP03.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*********@gma il.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*********@gma il.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*********@gma il.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*********@gma il.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*********@gma il.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*********@gma il.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
2792
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 help. Maybe something where i can start it. many thanx.
1
6300
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", stdin=subprocess.PIPE) # Run an octave called "startup". oct.communicate("startup") # Change directory inside octave.
8
4609
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 from embedded devices). Currently, we are using a heavyweight, proprietary log tool developed by another part of the company. This tool contains all "standard" logging functionality, but we also need to insert "debug" log points in the software of...
5
1230
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? Thanks in advance, H. Lam
3
7127
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 via a serial connection (RS-232), but am not sure as the process if it is connected via USB. Is the USB port seen then as a COMM port, or is there a different type of connection a USB port creates that I would have to open? The scale will take as...
3
1280
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 = child_stdout.readline() print "Got here 2" child_stdin.write(line) child_stdin.close
6
3184
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 just I can make them communicate over the internet. -- Mike
0
1908
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 Qt4 TCP Socket Programming. I am new to Qt and struggling to make the Client to communicate with Server. (Both Server & clients are right now on the Same SuSE 9.3 Linux System) I want to know does this method is correct ? Does we can have clients...
8
9167
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 3. Close the shell I could do it using communicate if I concatenate all my commands ( separated by newline ) and read all the output in the end. So basically I could do following sequence: 1. command1 \n command2 \n command 3 \n
0
9705
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
9576
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10323
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
10311
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,...
1
7613
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
5516
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
4292
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
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2988
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.