Command Line Arguments passing in VB5.0
How to use “Command Line Arguments:” of “Make” tab in “Project Properties” window of Visual basic 5.0 project?
I have developed a Visual basic 5.0 application. The application works just fine in the user interactive mode.
However, I now want it to run from the command prompt and want to pass command line arguments to the application as well. If arguments were passed, application would run accordingly other wise it would run in the normal user interactive mode.
How can I do that?
For example, my application’s first screen asks user to enter user id and password. I want my program to except user id and password information from the command line.
If the executable application is MyApp.exe, following command would ask user to enter user id and password in user interactive mode
C:>MyApp.exe
However, I want my application to run for any of the following commands, in that case it would not ask for user id and password at run time.
C:>MyApp.exe userid password
or
C:>MyApp.exe –U userid –P password
Any suggestions, help would be greatly appreciated.
Thanks a lot in advance for your help
Dhirendra
[email protected]
Re: Command Line Arguments passing in VB5.0
You need use the Command function to get the command line arguments.
Dim CmdLine as string
CmdLine = Command()
If you run your application like
MyApp.exe userid password
then CmdLine is "userid password".
Use “Command Line Arguments:” of “Make” tab in “Project Properties” window for test this option.
Best Regards.
[email protected]
http://vbcode.webhostme.com/
Re: Command Line Arguments passing in VB5.0
There's a good example of handling multiple command line arguments at :
http://codeguru.developer.com/vb/articles/1755.shtml
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb