set and white spaces
Posted: 21 May 2011 14:34
Hi,
i know white spaces are used as string delimiters, but how to avoid the last byte in environment variable equal to space?
Ex.:
gives always [file.ex_]s[filename] .EXTe
Notice that TT=!TT:~0,-4! is same as TT=%%~nG
Thank you
i know white spaces are used as string delimiters, but how to avoid the last byte in environment variable equal to space?
Ex.:
ECHO ON & SETLOCAL EnableDelayedExpansion & SETLOCAL EnableExtensions
FOR /F "delims= " %%G in ('DIR /S /B ^| FINDSTR ".ex1 .ex2 .ex3 .ex4"') DO (
SET TT=%%G & SET TT=!TT:~0,-4! & ECHO.%%Gs!TT!.EXTe
)
EXIT /B
gives always [file.ex_]s[filename] .EXTe
Notice that TT=!TT:~0,-4! is same as TT=%%~nG
Thank you