1.

Solve : %%BLAH or %BLAH%!??!?!??

Answer»

I know that %variables_have_percent_marks% but what %%is_this? is it also a variable?Take a nice long look at for /? the next time you open the command prompt...you may just learn something.

In the mean time, here is what you wanted:
%variables% are used with the SET command are are called variables. Whatever their value is replaces it.
%%a is not an actual variable. It is a token used in for loops. It only substitutes the value while in a for loop. It can't be changed manually, like a regular variable.

For example, both these codes will do the exact same thing, but they are different as you can see. 
Code: [Select]echo off
:loop
set /a num+=1
echo %num%
if %num%==10 goto stop
goto loop
:stop
pause Code: [Select]echo off
for /l %%a in (1,1,10) do echo %%a
pausealso, it's only double-percent SIGNS when in a batch file. you can type for commands on the command line, but you must use a single percent sign:

Code: [Select]C:\Windows>for /f "tokens=*" %P in ('dir /s /B') do echo %P
set a=1&call echo %%a%% Code: [Select]Microsoft Windows XP [Version 5.1.2600
(C) Copyright 1985-2001 Microsoft Corp

d:\batch>set a=1&call echo %%a%%
%1%

d:\batch>
Quote from: Geek-9pm on February 24, 2010, 11:08:48 PM

Code: [Select]Microsoft Windows XP [Version 5.1.2600
(C) Copyright 1985-2001 Microsoft Corp

d:\batch>set a=1&call echo %%a%%
%1%

d:\batch>


my thoughts EXACTLY... not sure what is being said with that...test it in a .bat file Quote from: Prince_ on February 24, 2010, 10:58:14 PM
set a=1&call echo %%a%%
Quote from: Prince_ on February 25, 2010, 12:52:56 AM
test it in a .bat file



C:\>type   a25.bat
Code: [Select]echo off

REM "Test it in a .bat file"

set a=1&call echo %%a%%
Output:

C:\> a25.bat
1

C:\>

  Not worth bananas. Please do not waster the bananas.


Discussion

No Comment Found