Run Dos Command

  • Thread starter Thread starter MadCrazyNewbie
  • Start date Start date
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
 
* "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>
 
* "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")'.
 
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
 
* "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)
///
 
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
//
 
* =?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'.
 
Back
Top