View Full Version : Running DOS Command using VB

02-08-2005, 01:17 PM
Hello ,

I want to run this DOS command line using VB.

set IMODE=c:\tng0~2\bin
mode -u=username -p=password -m=normal

I used to manually run it in DOS Commmand. I want to run this from my VB program but I don't have any clue.
Your help is very appreciate

Thank you in advance.

02-08-2005, 03:19 PM
Use the Shell function.


02-14-2005, 11:55 AM
Hi ,

I am doing it in slightly different way. Since I have a number of commands to be executed, I am writing them to a batch file (temporary batch file ) and am executing it.

But I have a question. Is it possible to see the command window while the batch file is executing ? I wish to see the output returned by executing the command. How is it possible with VB6 ? Please help. I would like to know if the commands have been executed successfully or not.

Your Advice is greatly appreciated.


02-14-2005, 01:13 PM
You'll need to use the Win32 Console (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mslu/winprog/unicode_layer_console_functions.asp) functions.

Using Win32 API functions from VB (http://www.mentalis.org/vbtutor/dlls2.shtml).