Batch File If contains

April 28, 2009 at 13:53:29
Specs: Windows Vista
I want the user of my Batch File to type in a sentence, and if it contains a 'keyword' i want them to be directed to a section of the batch file.

Thing is, I'm currently using:
if '%input%'=='keyword' goto keyword
and at the bottom i have (to be sure):
goto %input%

Using this, the keyword has to be at the beginning of the sentence.

So, if the keyword is 'made', then i would work if the user typed 'made', but not if they typed 'who made you'.

Is there a way for the keyword to be anywhere in the sentence?

See More: Batch File If contains

Report •

April 28, 2009 at 14:04:35
if not "%input:keyword=%"=="%input%" goto keyword

Report •

April 29, 2009 at 11:19:09

is there a way to have two keywords, both required to access

Report •

April 29, 2009 at 13:58:59
if not "%input:keyword1=%"=="%input%" (
if not "%input:keyword2=%"=="%input%" goto keyword

Report •

Related Solutions

Ask Question