Batch if mit Platzhalter im String
Hallo Team
cmd und batch
wie kriege ich es hin daß ein Variablenvergleich mit einen Platzhalter akzeptiert wird ?
den passenden operator brauche ich.
set var1=Hallo
set var2=Hal*
if %var1% operator %var2% (
echo true
)
Danke im Vorraus
Gruß rsadmchef
cmd und batch
wie kriege ich es hin daß ein Variablenvergleich mit einen Platzhalter akzeptiert wird ?
den passenden operator brauche ich.
set var1=Hallo
set var2=Hal*
if %var1% operator %var2% (
echo true
)
Danke im Vorraus
Gruß rsadmchef
Please also mark the comments that contributed to the solution of the article
Content-Key: 207723
Url: https://administrator.de/contentid/207723
Printed on: April 1, 2023 at 06:04 o'clock
2 Comments
Latest comment
Hallo rsadmchef,
Alternative:
Durch Ändern von Zeile 8 in
kann die Berücksichtigung von Groß-/Kleinschreibung deaktiviert werden.
Gruß
Friemler
Alternative:
@echo off & setlocal
set "var1=Hallo"
set "var2=Hal"
call set "var3=%%var1:%var2%=%%"
if "%var2%%var3%" equ "%var1%" (
echo True
)
Durch Ändern von Zeile 8 in
if /i "%var2%%var3%" equ "%var1%" (
Gruß
Friemler