Utility to search for string in string

  • Thread starter Thread starter flahmeshess
  • Start date Start date
F

flahmeshess

In my batch, I want to search for a string in a environment variable,
possible ? Any utility to do that ?

eg.

SearchStr %1 %bigstring%

Is there any such Search utility that can search %1 in %bigstring% and
return an errorlevel for subsequent steps ?

Thanks very much.
 
flahmeshess said:
In my batch, I want to search for a string in a environment variable,
possible ? Any utility to do that ?

eg.

SearchStr %1 %bigstring%

Is there any such Search utility that can search %1 in %bigstring% and
return an errorlevel for subsequent steps ?

Thanks very much.

Try this:

echo %bigstring% | find /i "%1"
 
Don't know why. This works on the command line but when I put it in a
batch *.bat, the errorlevel is not changed. To be exact, it changes
the first time but when I run the batch from the command line again,
the errorlevel is stuck with the old errorlevel regardless of whatever
values I use to search.

Help ?
 
Let's have a look at your batch file!


flahmeshess said:
Don't know why. This works on the command line but when I put it in a
batch *.bat, the errorlevel is not changed. To be exact, it changes
the first time but when I run the batch from the command line again,
the errorlevel is stuck with the old errorlevel regardless of whatever
values I use to search.

Help ?
 
Back
Top