By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,996 Members | 1,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,996 IT Pros & Developers. It's quick & easy.

Run a DOS command

P: n/a
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
Mar 2 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Michael Roebuck" <mi**********@ntlworld.com> wrote in message
news:mY*******************@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?

Mar 2 '06 #2

P: n/a
"Homer J Simpson" <no****@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/>

Mar 2 '06 #3

P: n/a
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
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:Oa**************@TK2MSFTNGP12.phx.gbl...
"Homer J Simpson" <no****@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/>

Mar 3 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.