Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Set a batch variable (%1 - %n) when TCC is executing a batch file

Aug
1,904
68
Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  26.02.42 x64   Windows 10 [Version 10.0.18363.900]
1596117860539.png

In the help for SET it says;
Code:
/B    Set a batch variable (%1 - $n). Only valid when TCC is executing a batch file.

So, from a batch file, I did this;
Code:
*set /B1=ABC
echo %1
quit
which I thought would assign ABC to the %1 Batch file parameter, but it returned this;
Code:
TCC: (Sys) E:\Utils\regenv.btm [1]  The parameter is incorrect.
"1"
ECHO is OFF
What is the proper way to use the /B option from a batch file?

Joe
 
It doesn't work here.
Code:
v:\> type batchvars.btm
*set /B 1=foo
echo %%1 = %1

v:\> batchvars.btm
TCC: (Sys) V:\batchvars.btm [1]  The parameter is incorrect.
 "1"
%1 =
 
I see. It has to exist in order to be set.

{code]
v:\> type batchvars.btm
echo %%1 = %1
*set /B 1=foo
echo %%1 = %1

v:\> batchvars.btm xx
%1 = xx
%1 = foo[/code]
 

Similar threads

Replies
4
Views
2K
Back
Top