I'm trying to pass a command-line argument < (single angle bracket, without quotes) to a C++ program during a debugging session in Visual Studio. As described in Project settings for a C++ debug configuration, < has special meaning as a redirection operator, but it does not specify how to escape it. I've tried using "<" and ^<, but none of them do what I want. Invoking the command from command line with the "<" argument works as expected.
So it looks like debugging command arguments are preprocessed first. Is there any way to escape a character from this preprocessing?
1 Answer 1
Seems like passing "<" works if "Start debugging" is used. I was using "Start Without Debugging", so the problem can be reproduced by passing "<" to an empty console application and invoking "Start Without Debugging".
"Start Without Debugging" seems to actually invoke cmd.exe, so command arguments are subject to command line interpretation rules. The question then turns out to be really how to escape < in a command line. < outside double quotes can be escaped by using ^<, but I still have no idea how to escape < inside double quotes.
I must say it's somewhat surprising that interpretation of debugging command arguments is subject to different rules depending on how the program is started.
2 Comments
Explore related questions
See similar questions with these tags.
<works because it's not an argument, it's a redirect operator. It won't actually pass an argument to your executable. As I stated in the question, I want to pass a single argument - the<string.