Run a DOS command

  • Thread starter Thread starter Michael Roebuck
  • Start date Start date
M

Michael Roebuck

Hi all

I'm very new to VB - I am trying to run a DOS command from within a VB2005
asp.net web site using a command button?

The DOS command will take the form of the command followed by several
switches!

Any ideas examples gratefully accepted.

P.S. If this is the wrong group please accept my apologies (and let me know
where to post).

Thanks in advance
 
I'm very new to VB - I am trying to run a DOS command from within a VB2005
asp.net web site using a command button?

The DOS command will take the form of the command followed by several
switches!

SHELL doesn't work from there?
 
Homer J Simpson said:
SHELL doesn't work from there?

.... or 'System.Diagnostics.Process.Start'...

Note that some commands are actually part of the command shell "cmd.exe"
(environment variable 'comspec'). Thus it's necessary to call "cmd.exe"
instead of the command and pass the command as an argument
('Process.Start("cmd", "bla")').
 
More precisely: Process.Start("cmd.exe", "/C <command> <switches and
parameters>").

Change /C to /K to keep the command prompt window around after the command
finishes.
 
Back
Top