Utility to search for string in string

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

Pegasus \(MVP\)

"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"
 
F

flahmeshess

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"
 
F

flahmeshess

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 -
 
P

Pegasus \(MVP\)

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 -

>
>
 
P

Pegasus \(MVP\)

"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?
 
F

flahmeshess

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?
 

Similar threads

D
Replies
0
Views
19
DouglasWilliams6
D
P
Replies
0
Views
44
Purnaman
P
D
Replies
0
Views
52
Daniel Esposito1
D
Back
Top Bottom