I'm using TCC 19.10.54 x64 in Windows 7 Pro 64bit to run a batch file that accepts two arguments from the command line. The second argument contains escaped characters. In the batch, I'm assigning the second argument to a variable. I'm having problems with the variable displaying the correct output. The variable should display the same output as the command line argument2, however the variable displays different output. Below is the batch file code and the actual and expected output. Also, I tried this with TCC 21.00.20 x64 and get the same output. Is this the incorrect way to do this, a bug, or this cannot be done this way?
Actual Output
--------------
[C:\Users\testuser\AppData\Local\Temp]bf.bat x @^%^%$#
cmdline arg1 value is: x
cmdline arg2 value is: @%$#
variable arg2 value is: @x @%$##
Excepted Output
----------------
[C:\Users\testuser\AppData\Local\Temp]bf.bat x @^%^%$#
cmdline arg1 value is: x
cmdline arg2 value is: @%$#
variable arg2 value is: @%$#
Thanks.
Code:
@echo off
rem Print the command line argument1 value.
echo cmdline arg1 value is: %1
rem Print the command line argument2 value.
echo cmdline arg2 value is: %2
rem Assign the command line argument2 value to a variable.
set arg2=%2
rem Print the variable containing the command line argument2 value.
echo variable arg2 value is: %arg2
quit
Actual Output
--------------
[C:\Users\testuser\AppData\Local\Temp]bf.bat x @^%^%$#
cmdline arg1 value is: x
cmdline arg2 value is: @%$#
variable arg2 value is: @x @%$##
Excepted Output
----------------
[C:\Users\testuser\AppData\Local\Temp]bf.bat x @^%^%$#
cmdline arg1 value is: x
cmdline arg2 value is: @%$#
variable arg2 value is: @%$#
Thanks.