How to concatenate variable with string or variable in batch file
I would like to concatenate a variable with a string. In line 7 to line 11 I try to concat !somevariable! with a string or with %%P variable. But this does not seem to work. I.e. you have file 0_1_en.pdf in current folder. The script shortcuts the name of file to first digit. Afterwards I want to create a new variable with a string for example: "GEN 0" where 0 is the !sPDFName! Complete code: 1 SETLOCAL EnableDelayedExpansion 2 for /f "delims=" %%P in ('dir /b *.pdf') do ( 3 SET "sPDFName=%%~nxP" 4 echo "!sPDFName:~0,1!" 5 IF "!sPDFName:~0,1!"=="1" (SET "sPDFName=!sPDFName:~0,1!") 6 IF "