AppArgs and escape characters?
BlitzMax Forums/BlitzMax Programming/AppArgs and escape characters?
| ||
I have this simple code:For Local a:String = EachIn AppArgs Print a Next Here's the result of running it with two different inputs on the commandline: > myapp "folder1" "folder2" 3 myapp.exe folder1 folder2 > myapp "folder1\" "folder2\" 2 myapp.exe folder1" folder2" Anyone know how to fix that? |
| ||
This is normal behaviour ... and I think this is passed that way to BlitzMax. the console takes care of the quotation marks (to allow "spaces" in paths...). To send the quotation marks to the app, you need to escape them - via prefixed backslash. So: this is no issue with BlitzMax. Call it with: myapp "\"folder1\"" "\"folder2\"" if you really need myapp.exe "folder1" "folder2" bye Ron |
| ||
I don't need to include the quote marks, it just seems like a bug that including the trailing slash in a folder name causes the two args to get merged. I suppose if it's the OS doing it then it can't be helped but it just struck me as odd. |
| ||
The backslash at the end is used as an escaping initializer for the quotation mark. there is no need to append a backslash to a path. If you really nees one at the end...then escape that char too: \\ Like said... I think this is an OS/console issue not a problem with Blitzmax. Bye Ron |
| ||
This should give you an explanation. https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ |