windows - Checking if the output is OK -


I am running a command with CMD through a batch file.

  echo phase 3. TNSPING tnsping vtdbs 2 & gt; If the error set 1 error is not checked for NUL, then Error set 1 = Set error = PASSED error level 1 set error = FAILED resonance result:% Error%   

but it only Tells me whether really was able to run the command. When this command is running, it gives an output.

  Blah blah blah blah blah blah blah blah blah blah Blah blah blah blah fine (80 milliseconds)   

The person should say "OK" as long as it happens .. Buzz: Passed else RESULT: unsuccessful

but It is not sure what the 8th line is, how to check it and see. "OK"

Here's a more efficient solution, it is also tolerant if tnsping vtdbs The output of is & lt; & Gt; 8 lines

  echo step 3. To check the TNSPING set in "error = FAILED" in / f %% i ('tnsping vtdbs 2 ^ & gt; NUL') (if "%% I" == "OK" (set "error = passed" and next): next single result:% error%   

You have to check whether <% I match is ok (?? ms) is that for / f default "tokens = 1" - or, in other words , Assigning %% I to the first word of each line.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -