Inside a batch file you need to use two %
:
FOR /F "delims=" %%a IN ('DIR /B /S *.c') DO @ECHO %%~na.o \"
문제
I want to print all the C files in a folder (including subfolders) without the path and with suffix .o \
instead of .c
.
So I found this command that works in cmd:
FOR /F "delims=" %a IN ('DIR /B /S *.c') DO @ECHO %~na.o \"
But when I create a bat file with this command only (one line) I get this output:
~na.o was unexpected at this time
.
C:\temp>FOR /F "delims=" ~na.o \"
I undestand from the second line that it has problem with the variable %a
.
How should i write the above command in a batch file?
해결책
Inside a batch file you need to use two %
:
FOR /F "delims=" %%a IN ('DIR /B /S *.c') DO @ECHO %%~na.o \"