I have a batch file which does something like this
for %%a in (1 2 3 4 5) do dir > %%a.output
%%a
just gives me a .
How can I use the value of the variable %%a
to assign the file name (e.g. 1.output, 2.output) ?
You have to surround your variable:
for %a in (1 2 3 4 5) do dir > %a%.output