Reputation: 3
01: SETLOCAL EnableExtensions EnableDelayedExpansion
02: ...
03: IF /i "%tValueType%" EQU "string" (
04: SET "vValueBefore=%1"
05: SET "vValueAfter=%2"
06:
07: FOR %%p IN (equ neq sub) DO (
08: IF /i "!tOperator!" EQU "%%p" (
09: SET "tOperatorValid=valid"
10: IF /i "!tOperator!" EQU "sub" (
11: SET "tConditions="!vValueAfter:!vValueBefore!=!" NEQ "!vValueAfter!""
12: ) ELSE (
13: SET "tConditions="!vValueBefore!" %tOperator% "!vValueAfter!""
14: )
15: )
16: )
17: )
18: ...
Line 11: I want replace substring to "" (cut substring) in string but error.
Upvotes: 0
Views: 147
Reputation: 67256
11: for /F "delims=" %%v in ("!vValueBefore!") do SET "tConditions="!vValueAfter:%%~v=!" NEQ "!vValueAfter!""
Upvotes: 1
Reputation: 80203
SET "tConditions="!vValueAfter:%vValueBefore%=!" NEQ "!vValueAfter!""
should work, since vValueBefore is not being changed in the loop
Upvotes: 2