EDIT: I neglected to note that I am using the Dec 7, 2020 Development release of QB64 (64-bit) running on Win 10 20H2
I'm passing parameters to a QB64 program but can't get it consistently read the parameters.
There is something really interesting about the behavior.
Let's start with sample code:
I compile the program and call it "test.exe".
Brief explanation: All that this program does is display the parameters passed to it on the command line.
This where it gets interesting.
Below are several runs of the program with the resulting output. My comments are shown before each run. Note that my goal is to pass GUID volume IDs as at least one of the parameters but as the last sample below shows, the problem is not limited to passing GUID Vol IDs.
1) In this run I pass a GUID Volume ID with a backslash at the end. On my particular system this is equivalent to "I:\". Note how the backslash at the end has been stripped off.
C:\QB64_Test>test "\\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}\"
Parameter 1 is : \\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}"
2) Here I run the command with "\Folder1" at the end (equivalent to "I:\Folder1" on my system). The output is fine.
C:\QB64_Test>test "\\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}\Folder1"
Parameter 1 is : \\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}\Folder1
3) I add a backslash and it gets stripped off.
C:\QB64_Test>test "\\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}\Folder1\"
Parameter 1 is : \\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}"\Folder1
4) Here is a path with a space in it and it is handled just fine.
C:\QB64_Test>test "\\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}\Folder1\Folder 2"
Parameter 1 is : \\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}\Folder1\Folder 2
5) Here is another path with a space in it. Notice how the output on this one is completely butchered!
C:\QB64_Test>test "\\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}\My Media"
Parameter 1 is : \\My Media
6) This next one is not a valid path, but it simply illustrates the odd behavior. This is the same input as #5 above but without the backslash before "my media", and this works fine! Why?
C:\QB64_Test>test "\\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}my media"
Parameter 1 is : \\?\Volume{06b8848c-3cfc-11eb-a783-60f2624ff3b8}my media
7) Just to show that the issue has nothing to do with the structure of a GUID vol ID, here is a simpler input that outputs incorrectly:
C:\QB64_Test>test "this is a test\"
Parameter 1 is : this is a test"
-------------------
Why is this behavior so odd? My code is crazy simple so I have a hard time believing I have anything wrong within the code, but if I do I would love to know what it is.
Any insight would be greatly appreciated.