QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: vince on September 09, 2018, 04:20:23 pm
-
Hi all
I am trying to run a program using the SHELL command, but the command is not running. Problem is I cant event determine what the issue is because the message that comes up in the DOS box after executing the SHELL command, disappears so quickly.
Is there any way I can stop the SHELL cmd window disappearing so I can read the error, if there is one. Or if anyone has any other idea how I can see this result of the SHELL, that would allow me to determine the problem.
Thanks
-
Try redirecting the output to a file:
SHELL "MYCOMMAND.EXE > DEBUG.TXT"
Welcome to the forum.
-
or if the program output is short, use the BAT file:
OPEN "runme.bat" FOR OUTPUT AS #1
PRINT #1, "dir"
PRINT #1, "pause"
CLOSE
SHELL "runme"
-
Sometimes SHELL can't read a path, because a space is involved, like "c:\program files\" the way around that is to enclose it in quotes:
SHELL "c:\" + chr$(34) + "program files" + chr$(34) + "\myfile.exe"
Where chr$(34) represents the ASCII value for quote marks.
You can check out the _CONSOLE statement to keep the SHELL command window open in the WIKI.
You could try START as in SHELL _dontwait "START notepad.exe" START is usually implied in QB64 but it might be worth a try. Some Windows programs START will find, without including a path. Notepad is one of those types of programs. the .exe can be left off, as it is also implied.
Hope you get it working,
Pete
-
Hi all
Thanks for your responses. I tried all suggestions, but the batch file worked a treat. The command I ran in the SHELL command, it turns out, was not being recognised as an internal or external command. probably no surprise there, but I just couldn't be certain.
Thanks for all your input though.
Vince