I need some batch-noob-treatment.
I'm trying to rename all the files in a folder and I'm slowly getting there, but although I got the step right with some google help, I would like to know what I'm doing.
Here is my code until now:
@ECHO OFF
setlocal enabledelayedexpansion
set a="dir /b"
FOR /F "delims=" %%i IN (' %a% ') DO (
set str=%%i
set str=!str:~1!
echo !str!
)
Anything else I put inside the for loop brings out strange results. I know the enabledelayedexpansion
and !
are somehow connected and make this work, but how is the inside of a for loop different from the normal commands in batch, so that special syntax is needed?
What goes wrong if I put in code like that:
@ECHO OFF
set a="dir /b"
FOR /F "delims=" %%i IN (' %a% ') DO (
set i=%i:~1%
echo %%i
)