Variables acting very wierd - New to batch programming
Posted: 11 Sep 2007 13:46
Simple code
-----1.BAT-------
set outdir=%1
FOR /D %%F IN (%outdir%) (
set dir1=%%F
echo %dir1%
)
---------------------
I have c:\new
c:\new\1 <DIR>
c:\new\2 <DIR>
c:\new\3 <DIR>
when I execute it like this
C:\> 1.BAT \new\*.*
its assigning set dir1=\new\1
echo \new\3
set dir1=\new\2
echo \new\3
set dir1=\new\3
echo \new\3
Why is it not showing me \new\1 and \new\2 and \new\3 in the echo statements. Please help.
-----1.BAT-------
set outdir=%1
FOR /D %%F IN (%outdir%) (
set dir1=%%F
echo %dir1%
)
---------------------
I have c:\new
c:\new\1 <DIR>
c:\new\2 <DIR>
c:\new\3 <DIR>
when I execute it like this
C:\> 1.BAT \new\*.*
its assigning set dir1=\new\1
echo \new\3
set dir1=\new\2
echo \new\3
set dir1=\new\3
echo \new\3
Why is it not showing me \new\1 and \new\2 and \new\3 in the echo statements. Please help.