Run a DOS command

  • Thread starter Michael Roebuck
  • 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
 
H

Homer J Simpson

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?
 
H

Herfried K. Wagner [MVP]

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")').
 
C

CMM

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.
 

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