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!

Running Command Line App/ Std Output(Screen) ???

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
US
I'm writing a PB6.5 application that will run from the command line(DOS prompt). If the user does not enter the proper(required) parameters I want to send a message back to the screen so the user can see what the proper syntax is.

The only way I've been able to do this is by:

I'm using the Run() function in PB and passing to it the name of a batch file. This batch file includes the following:

type usage.txt

The usage.txt file includes the proper syntax for my application. The method descibed above does work, but I have questions.

When it displays the contents of usage.txt, it displays it in a second dos window. How can I display this file in the same dos window as the one where I executed my application?

Is there another method to accomplish writing out to the screen?

Keith
 
Instead of running a seperate batch file, I would wrap the program you are running in a batch file and populate the return code from application close event. This number would be available in the batch file as the ERRORLEVEL variable.

you would have to pass your parms to the batch program via the %# variables

myprog.bat
---------------

MyPBApp %1 %2 %3 %4
IF ERRORLEVEL = 1 type ErrMsg.txt | more

----------------

It would be nice if you could do a fileopen of the CON: device so your PBApp could write directly to the console, but that doesn't appear to work.

 
In this message, you mention "populate the return code from application close event". I need to do this, too, but I can't find any documentation on it. What syntax do you use?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top