1.

Solve : Two var into One?

Answer»

how can i make that if i have that code
Code: [Select]set var1=b
set VAR2=7
set b7=O
if %var1%%var2%==O goto A
echo B
:A
echo A
pauseto make a variable CHECK from another TWO...?
i want to chceck if b7 equ O but making this var from var1 and var2
sory if you cant know what im seying mabey you understandYou cannot do this. You are confusing variable names and variable values.

u can only do that if u store value of "%var1%%var2%" into valid variable name.
so, your code should be like this :
Code: [Select]set var1=b
set var2=7
set b7=o
call set temp_var=%%%var1%%var2%%%
if "%temp_var%"=="o" goto A
echo B
:A
echo A
pause
Worked!
Thanks!Quote from: Fen_Li on FEBRUARY 23, 2008, 10:27:22 AM

u can only do that if u store value of "%var1%%var2%" into valid variable name.

Sorry, but not true!

Quote

@echo off
set var1=b
set var2=7
set b7=0
echo var1=%var1%
echo var2=%var2%
echo b7=%b7%
echo var1var2=%var1%%var2%
if "%var1%%var2%"=="b7" echo BINGO


Quote

var1=b
var2=7
b7=0
var1var2=b7
BINGO




Discussion

No Comment Found