Utility to search for string in string

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

flahmeshess

Guest
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.
 
Re: Utility to search for string in string


"flahmeshess" <dingdongdingding@yahoo.com> wrote in message
news:1185531036.768844.236450@z28g2000prd.googlegroups.com...
> 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"
 
Re: Utility to search for string in string

Thank you thank you thank you.....

On Jul 27, 6:24 pm, "Pegasus \(MVP\)" <I....@fly.com> wrote:
> "flahmeshess" <dingdongdingd...@yahoo.com> wrote in message
>
> news:1185531036.768844.236450@z28g2000prd.googlegroups.com...
>
> > 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"
 
Re: Utility to search for string in string

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 ?

On Jul 27, 10:51 pm, flahmeshess <dingdongdingd...@yahoo.com> wrote:
> Thank you thank you thank you.....
>
> On Jul 27, 6:24 pm, "Pegasus \(MVP\)" <I....@fly.com> wrote:
>
>
>
> > "flahmeshess" <dingdongdingd...@yahoo.com> wrote in message

>
> >news:1185531036.768844.236450@z28g2000prd.googlegroups.com...

>
> > > 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"- Hide quoted text -

>
> - Show quoted text -
 
Re: Utility to search for string in string

Let's have a look at your batch file!


"flahmeshess" <dingdongdingding@yahoo.com> wrote in message
news:1185774151.404232.198840@x35g2000prf.googlegroups.com...
> 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 ?
>
> On Jul 27, 10:51 pm, flahmeshess <dingdongdingd...@yahoo.com> wrote:
>> Thank you thank you thank you.....
>>
>> On Jul 27, 6:24 pm, "Pegasus \(MVP\)" <I....@fly.com> wrote:
>>
>>
>>
>> > "flahmeshess" <dingdongdingd...@yahoo.com> wrote in message

>>
>> >news:1185531036.768844.236450@z28g2000prd.googlegroups.com...

>>
>> > > 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"- Hide quoted text -

>>
>> - Show quoted text -

>
>
 
Re: Utility to search for string in string


"flahmeshess" <dingdongdingding@yahoo.com> wrote in message
news:1185896464.455462.304100@z24g2000prh.googlegroups.com...
> Seems to work now. Thanks !
>


I love these things that fail one day and work the
next. Perhaps a little typograpical error?
 
Re: Utility to search for string in string

Don't know why. I hope it's a typo cause I cannot explain why !

On Aug 1, 3:11 am, "Pegasus \(MVP\)" <I....@fly.com> wrote:
> "flahmeshess" <dingdongdingd...@yahoo.com> wrote in message
>
> news:1185896464.455462.304100@z24g2000prh.googlegroups.com...
>
> > Seems to work now. Thanks !

>
> I love these things that fail one day and work the
> next. Perhaps a little typograpical error?
 
Back
Top