Page 1 of 1

Using filename in variable

Posted: 13 Mar 2015 19:45
by karaziki
I was thinking it will be easy but become a headache
I'm trying to set a variable contains filename like;

Code: Select all

SET %~n1_var=(%~z1)
or
SET /a %~n1_var=(%~z1)

But when it comes to call back, even I couldn't test is it set or not like;

Code: Select all

ECHO "%%~n1_var%"
or
ECHO "%~n1_var%"

I tried many combinations (like an idiot) but none of them work.
Is there a way to handle it?

All bests
Evren

Re: Using filename in variable

Posted: 13 Mar 2015 20:09
by Squashman
Try using delayed expansion.

Re: Using filename in variable

Posted: 13 Mar 2015 20:35
by karaziki
Ah yess, thank you
It respond in echo as expected. Time to integrate.

All Bests