Home All Groups Group Topic Archive Search About
Author
2 Mar 2006 7:46 PM
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

Author
2 Mar 2006 7:51 PM
Homer J Simpson
"Michael Roebuck" <mick.roeb***@ntlworld.com> wrote in message
news:mYHNf.65959$K42.32109@newsfe7-win.ntli.net...

> 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?
Author
2 Mar 2006 11:23 PM
Herfried K. Wagner [MVP]
"Homer J Simpson" <nob***@nowhere.com> schrieb:
>> 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?

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

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
3 Mar 2006 2:37 AM
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.

--
-C. Moya
www.cmoya.com
Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:Oam$LBlPGHA.1532@TK2MSFTNGP12.phx.gbl...
> "Homer J Simpson" <nob***@nowhere.com> schrieb:
>>> 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?
>
> ... 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")').
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>