Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command lines in VB 6.0

Status
Not open for further replies.

herci

Programmer
Nov 8, 2002
23
PA

Hi.. I am kind of new using VB 6.0
Does VB have commands for running in command line (MSDOS)
because I want to run an application in VB 6.0 as a batch file?

any infomation will be appreciated..

thanks
 
yes. You can use the shell command to start a program.
E.g.

shell "notepad.exe c:\tmp\text.txt"

See also faq222-428 Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Can you clarify what you actually want? The answers given so far allow you to shell other applications from VB, but I get the feeling that what yu want to do is run your VB program as command-line application, interacting (i.e input and output) to the command-line. Is that correct?

 
Yes, that is correct, Strongm, I developed an application in where I load a some .csv file and I need to run it as a batch file from the command- line, just like sql does...

Can I do that?


thanks
 
Well, if I am understanding you correctly, the answer is that yes, you can. However, it is not at all easy or straightforward. VB programs are GUI applications, and during launch disassociate themselves completely from any command line.

Now, it is pretty simple to attach a new console (or command line) to a VB program once it is running, but not to associate with the command line that launched it. To achieve the latter involves a nasty hack (that rewrites the VB executable's header so that it can be launched as a console application). Are you really sure you need to go down this route? You may be better off using VBScript, which can be used as a batch language.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top