Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shell "dir" -- I expected something, but ..
#1
I expect to be humbled by this thread, but I expected something from the "dir" but get only "A" and "B".  Where is the output going?

Code: (Select All)
Print "A"
Shell "dir"
Print "B"
Reply
#2
To the console, where SHELL directs it to.

Try:
SHELL "dir>temp.txt"

Then you can OPEN "temp.txt" FOR INPUT AS #1 and read the contents of the file into your program.
Reply
#3
Notice that it is in the middle of the night here (Wyoming).  I was thinking about this -- I MAY have thought of your ">" answer.

Quote:dcromley: Where is the output going?

SMcNeill: To the console, where SHELL directs it to.

What console?  A better question is, what happens to that console?  Does it exist and then disappear? (yes)  How can I make it wait?  I googled "dos multi statement" and was led to https://stackoverflow.com/questions/8055371/.  "&"  What is the DOS "wait" command?  More searching.  "pause"

So, a program of interest is:

Code: (Select All)
Print "A"
Shell "dir & pause"
Print "B"

This shows my program console AND the SHELL console.  Hitting "any key" (twice?) in the SHELL window ends that process and "returns" back to the QB64 window to print the "B".

The bottom line is that your ">" suggestion is the way to get SHELL output.  Thanks.
Reply
#4
Normally a little console program like this simply opens and closes so fast that we never see it. If you want to view the console in QB64, try it like this:

Code: (Select All)
$Console
_Console On
Print "A" 'print "A" in the QB64 window
Shell "dir" 'view and run DIR in the console
Print "B" 'print "B" in the QB64 window
_ECHO "Hello World!" 'print hello world in the console
Reply
#5
Exclamation
Reply




Users browsing this thread: 1 Guest(s)