KenDown wrote: ↑Tue 24 Dec 2019, 04:46I suspect the behaviour you report has something to do with the value of @dir$.
This is at best misleading, and I wish you didn't feel the need to post a reply (however inaccurate) every time you approve one of my messages. It should be obvious that it cannot be directly a result of the value of
@dir$ because OSCLI (in this context) is simply passing the command to Windows for execution, and Windows cannot know anything about the internal workings of BBC BASIC such as the value of a system variable!
I did not reply in detail previously because I promised I would not post to the forum over the Christmas period, to give the moderator(s) a break. But since you have posted a reply that needs correction I feel I have no choice but to set the record straight. As I said, OSCLI (in this case) passes the command to Windows for execution, so this is entirely a Windows issue not a BBC BASIC issue.
The reason that 'notepad' works but 'bbcwrun6' doesn't is that the former is on the PATH (the environment variable which contains a list of directories to be searched) whereas the latter isn't. Typically 'notepad' will be in
C:\Windows\System32\ and you will find that this directory is always included in the PATH (unless you have deliberately excluded it for some reason) whereas 'bbcwrun6' is typically in
C:\Program Files (x86)\BBC BASIC for Windows\ which won't be in your PATH unless you have speciflcally added it.
So there are two ways to make
bbcwrun6 work: you could add it to your PATH by editing your environment variables, or you could supply an absolute (fully qualified) path and filename in your command, for example:
Code: Select all
OSCLI """C:\Program Files (x86)\BBC BASIC for Windows\bbcwrun6.exe"" D:\prog.bbc;"
Rather than specifying an a literal string you can generally assume that the required location is the parent directory of
@lib$:
Code: Select all
OSCLI """" + @lib$ + "..\bbcwrun6.exe"" D:\prog.bbc;"
Of course if you are 'compiling' the program which contains this statement, with a view to distributing it to somebody who may not themselves have BBC BASIC installed, then this still won't work because they won't have
bbcwrun6.exe anywhere on their PC!