Author Topic: Forcing command line output to a QB64 program window  (Read 2966 times)

0 Members and 1 Guest are viewing this topic.

Offline hanness

  • Forum Regular
  • Posts: 210
    • View Profile
Forcing command line output to a QB64 program window
« on: February 16, 2020, 07:05:42 pm »
I've written a program making an assumption which I am now questioning.

My program runs a LOT of Windows commands via the SHELL command. When I do this, the output from many of these commands are not displayed to the program window. As a result, I have my program set to display all output to a console only ($CONSOLE:ONLY).

Just to make sure that I'm not making a totally incorrect assumption, is there any way that I can force the output from command line utilities to display in a QB64 program window?

The following one line program illustrates the issue:

SHELL "dism /?"

When $CONSOLE:ONLY is used  then the help for the DISM command would be displayed to the console window, but without it, nothing is displayed.

Marked as best answer by hanness on February 17, 2020, 07:08:38 pm

FellippeHeitor

  • Guest
Re: Forcing command line output to a QB64 program window
« Reply #1 on: February 16, 2020, 07:15:31 pm »
You can't yet easily capture the output of SHELL calls. It is a proposed feature for a future version though: https://github.com/QB64Team/qb64/issues/8

What you could do is SHELL "thecommand >temp.txt"

Then you can read temp.txt with OPEN and display it on screen.
« Last Edit: February 16, 2020, 07:17:29 pm by FellippeHeitor »

Offline hanness

  • Forum Regular
  • Posts: 210
    • View Profile
Re: Forcing command line output to a QB64 program window
« Reply #2 on: February 18, 2020, 12:08:23 am »
Thanks for the suggestion. The one problem with that method is that some of the commands I run via SHELL output status over the course of maybe 20 minutes. To wait for the command to complete before I open the Temp file and display the results wouldn't work too well for displaying continual status updates.

However, my existing solution with output to console is working just fine for me for now. Just wanted to be sure I was not overlooking anything.

Thanks once again.