Vorrei concatenare una variabile con una stringa.Come concatenare la variabile con stringa o variabile nel file batch
Nella riga 7 alla riga 11 provo a concat! Somevariable! con una stringa o con variabile %% P.
Ma questo non sembra funzionare.
I.e. hai il file 0_1_en.pdf nella cartella corrente.
Lo script collega il nome del file alla prima cifra.
Poi voglio creare una nuova variabile con una stringa, ad esempio:
"GEN 0" where 0 is the !sPDFName!
codice completo:
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 "!sPDFName:~0,1!"=="0" (SET "sPDFName=!sPDFName:~0,1!")
7 SET tempStr=GEN !sPDFName!
8 SET myvar=!myvar! %%P
9
10 echo "%myvar%"
11 echo "%tempStr%"
12 ::echo "!sPDFName!"
13 pause
14 for /f "delims=" %%H in ('dir /b *.html') do (
15 IF "!sPDFName:~-0!"=="!%%H:~0,1!" echo %%H
16 )
17)
Grazie, questo è stato stupido da parte mia, di dimenticarlo – user1141649