Run Dos Command

M

MadCrazyNewbie

Hey Group,

Hows would I run a DOS command with Parameters in VB.Net Via a command
button?

The command I need to run is:
C:\Program Files\SOLO\AwSolo32.exe C:\TDR\1209\Solo32rt.SOL

Many Thanks
MCN
 
H

Herfried K. Wagner [MVP]

* "MadCrazyNewbie said:
Hows would I run a DOS command with Parameters in VB.Net Via a command
button?

The command I need to run is:
C:\Program Files\SOLO\AwSolo32.exe C:\TDR\1209\Solo32rt.SOL

I don't see any command.

You can use 'System.Diagnostics.Process.Start' to start an application
or open files. Have a look at 'ProcessStartInfo' and the overloaded
versions of 'Process.Start' too.

If you want to redirect input and output, have a look here:

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

Herfried K. Wagner [MVP]

* "MadCrazyNewbie said:
Do you have any links or code?

Opening a file:

\\\
Imports System.Diagnostics

..
..
..
Dim psi As New ProcessStartInfo()
psi.UseShellExecute = True
psi.FileName = "C:\bla.html"
Process.Start(psi)
..
..
..
///

Starting an application:

If you want to start an application, you can simply call
'System.Diagnostics.Process.Start("C:\bla.exe")' or in VB.NET
'Shell("C:\bla.exe")'.
 
M

MadCrazyNewbie

Great that worked, but how can I run arguments for the program? I tryed:

Shell("C:\Program Files\Sysmantec\PCAnywhere\Awhost32 LanHost.BHF")

But it doesn`t seem to run my arguments:(

Ta
Si
 
H

Herfried K. Wagner [MVP]

* "MadCrazyNewbie said:
Great that worked, but how can I run arguments for the program? I tryed:

Shell("C:\Program Files\Sysmantec\PCAnywhere\Awhost32 LanHost.BHF")

\\\
Dim psi As New ProcessStartInfo()
psi.FileName = "C:\bla.exe"
psi.Arguments = "abc.def"
Process.Start(psi)
///
 
G

Guest

Hello

For running the shell command from within VB, would it be possible to program such that the program will wait till the shell command finishes, before continue executing any subsequent code after the shell command

Thanks

Jo

----- Herfried K. Wagner [MVP] wrote: ----

* "MadCrazyNewbie said:
Great that worked, but how can I run arguments for the program? I tryed

\\ Dim psi As New ProcessStartInfo(
psi.FileName = "C:\bla.exe
psi.Arguments = "abc.def
Process.Start(psi
//
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?Sm9lIEJyb3du?= said:
For running the shell command from within VB, would it be possible to
program such that the program will wait till the shell command finishes,
before continue executing any subsequent code after the shell command?

Have a look at 'Process.WaitForExit'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top