0
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.

4
  • Please tag the language you are using. 1) for more exposure. 2) So others know what language you are working with. 3) For some languages you will get syntax highlighting :) Commented Dec 14, 2013 at 4:35
  • I use batch script :) Commented Dec 14, 2013 at 4:41
  • You can edit your question, and at the bottom, add a tag Commented Dec 14, 2013 at 4:43
  • I took care of it. Carry on... :o) Commented Dec 14, 2013 at 4:44

2 Answers 2

2
  SET "tConditions="!vValueAfter:%vValueBefore%=!" NEQ "!vValueAfter!""

should work, since vValueBefore is not being changed in the loop

Sign up to request clarification or add additional context in comments.

1 Comment

Line 04: I set vValueBefore in if. I not can get value of %vValueBefore%. If echo %vValueBefore% in line 11 -> "echo is off"
1
11:      for /F "delims=" %%v in ("!vValueBefore!") do SET "tConditions="!vValueAfter:%%~v=!" NEQ "!vValueAfter!""

2 Comments

Thank you I code FOR /f "delims=" %%v IN ("!vValueBefore!") DO ( SET "tConditions="!vValueAfter:%%~v=!" NEQ "!vValueAfter!"" )
+1, However, if vValueBefore may begin with any character, including ;, then should disable EOL using for /f delims^=^ eol^= %%v ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.