I can't help but feel I'm missing something obvious here, but I don't know what that is. As usual, a TCC session transcript.
The first time I just ran it directly from the command line with invalid arguments and it printed an error message and exited, presumably with a return code of 8. However, both %_?, which you would expect, and %?, which you would not, are zero.
So I ran it again with exactly the same arguments through @ExecStr and then checked %_ExecStr, and it was 8 as expected.
Unfortunately, it would be really nice for a calling batch file to have access to the return code to detect error(s), and @ExecStr and @ExecArray are both not satisfactory because the program is able to output an arbitrarily large number of lines.
The questions, therefore, are simple. What am I doing wrong when executing it directly from the command line? What do I misunderstand? And if I am misunderstanding something, how do I accomplish what I am trying to accomplish?
Code:
Mon Jan 14, 2013 10:00:06p
TCC 14.03.53 x64 Windows 7 [Version 6.1.7601]
Copyright 2012 JP Software Inc. All Rights Reserved
Registered to Daniel Mathews
[Z:\]CD "Development\C, C++\Utilities\DuplicateRemover\Release"
[Z:\Development\C, C++\Utilities\DuplicateRemover\Release]DuplicateRemover /A /B
Fatal Error: Invalid switch "/A"
Fatal Error: Invalid switch "/B"
Program is being terminated due to error(s).
[Z:\Development\C, C++\Utilities\DuplicateRemover\Release]Echo %_? %?
0 0
[Z:\Development\C, C++\Utilities\DuplicateRemover\Release]Echo %@ExecStr[DuplicateRemover /A /B] >NUL:
Fatal Error: Invalid switch "/A"
Fatal Error: Invalid switch "/B"
Program is being terminated due to error(s).
[Z:\Development\C, C++\Utilities\DuplicateRemover\Release]Echo %_ExecStr
8
[Z:\Development\C, C++\Utilities\DuplicateRemover\Release]
So I ran it again with exactly the same arguments through @ExecStr and then checked %_ExecStr, and it was 8 as expected.
Unfortunately, it would be really nice for a calling batch file to have access to the return code to detect error(s), and @ExecStr and @ExecArray are both not satisfactory because the program is able to output an arbitrarily large number of lines.
The questions, therefore, are simple. What am I doing wrong when executing it directly from the command line? What do I misunderstand? And if I am misunderstanding something, how do I accomplish what I am trying to accomplish?