[SOLVED] SET adds space to variable?
Posted: 27 May 2020 09:51
Hello,
In a FOR loop, I need to create a couple of variables so I can make use of them later.
For some reason, the following adds a space between the left side of the filename and its extension:
Do you know why? Is there a better solution?
Thank you.
In a FOR loop, I need to create a couple of variables so I can make use of them later.
For some reason, the following adds a space between the left side of the filename and its extension:
Code: Select all
REM c:\test.bat input.txt
FOR %%f IN ("%1") DO SET left=%%~nf & SET ext=%%~xf
ECHO %left%%ext%
REM Displays input .txt instead of input.txt
Thank you.