Code: Select all
IF "!Check!"=="BH" || IF "!Check!"=="TD" || IF "!Check!"=="RB" || IF "!Check!"=="RC" || IF "!Check!"=="AB" (
Some Commands
) ELSE (
Other Commands
)
It's telling me that | was unexpected at this time...
Moderator: DosItHelp
Code: Select all
IF "!Check!"=="BH" || IF "!Check!"=="TD" || IF "!Check!"=="RB" || IF "!Check!"=="RC" || IF "!Check!"=="AB" (
Some Commands
) ELSE (
Other Commands
)
Code: Select all
SomeCommand && (
Do Some commands if SomeCommand was successful (ERRORLEVEL=0)
) || (
Else do some other commands if SomeCommand failed (ERRORLEVEL<>0)
)
Code: Select all
set "test="
if <CONDITION 1> set test=1
if <CONDITION 2> set test=1
...
if <CONDITION N> set test=1
if defined test (
<Some Commands>
) else (
<Other Commands>
)
Code: Select all
set "test=/BH/TD/RB/RC/AB/"
if "!test:/%Check%/=!" neq "!test!" (
<Some Commands if found a match>
) else (
<Other Commands>
)
Code: Select all
set "test=/BH/TD/RB/RC/AB/"
if "!test:/%Check%/=!" neq "!test!" if "!test:/%Check%/=/%Check%/!" equ "!check!" (
<Some Commands if found a match>
) else (
<Other Commands>
)
Code: Select all
set "test=/BH/TD/RB/RC/AB/"
if "!test:/%Check%/=!" neq "!test!" (
<Some Commands if found a match>
) else (
<Other Commands>
)
Code: Select all
set "test=/BH/TD/RB/RC/AB/"
if "!test:/!Check!/=!" neq "!test!" (
<Some Commands if found a match>
) else (
<Other Commands>
)
Code: Select all
set "test=/BH/TD/RB/RC/AB/"
for /f "delims=" %%a in ("/!Check!/") do (
if "!test:%%a=!" neq "!test!" (
<Some Commands if found a match>
) else (
<Other Commands>
)
)
Code: Select all
if "%test:/!Check!/=%" neq "%test%"
Code: Select all
FOR /f "delims=" %%a IN ("/!Check!/") DO (IF "!test:%%a=!" neq "!test!" (SET "STN=G"))
...
IF "!STN!"=="G" (
Do my found a match commands
) ELSE (
Do my no match found commands
)
Acy Forsythe wrote:Thanks again Dave! I'll have to play around with that tomorrow... I was thinking about the test string you created, it won't change and can be set outside of a command block. I'm going to fool around with that tomorrow and see if I can get this to work instead:Code: Select all
if "%test:/!Check!/=%" neq "%test%"
Because ':~1,2' works only for variables which have to be defined beforehand, which makes two statements.And was told I had to put it in two set statements to do it... (In another thread).
Code: Select all
set "$var=This works" &for %%! in ( "$var" ) do set "%%~!=!%%~!:~1,2!"
I'm impressed, we'll talk again when you hit the 8k barrier.And not a single :function call.
Ed Dyreen wrote:'Code: Select all
set "$var=This works" &for %%! in ( "$var" ) do set "%%~!=!%%~!:~1,2!"
Code: Select all
set "Check=%%C"
set "Check=!Check~1,2!"
Code: Select all
FOR /f "delims=" %%a IN ("/!Check~1,2!/") DO (IF "!test:%%a=!" neq "!test!" (SET "STN=G"))
Code: Select all
SET Check=%%C
SET "test=/BH/TD/RB/RC/AB/" <--- Just moved this outside of the loop.
FOR /f "delims=" %%a IN ("/!Check~1,2!/") DO (IF "!test:%%a=!" neq "!test!" (SET "STN=G"))