Batch file with if else command

February 25, 2011 at 03:20:48
Specs: Disk Operating Sytem

I have created a simple text file (c:\temp.txt) with includes some text.
Now I want to create a batch file & my requirement is
If the temp.txt file contains a particular word (example: XP) then it'll call a file (example: c:\xp.txt)

{In short: i want to search the temp.txt file, if it contains word "XP" then call c:\xp.txt}

See More: Batch file with if else command

Report •

February 25, 2011 at 09:04:31

Report •

February 25, 2011 at 20:33:54
Thanks for your reply...

I want to search a text file for a particular word, and if that word exist in that file then call another file which is also already created.

Anyone can help me here???

Report •

February 26, 2011 at 14:24:01
You said: if it contains word "XP" then call c:\xp.txt

How can you "call" a text file?

Report •

Related Solutions

February 26, 2011 at 20:39:10
have you read the article given by ace_omega yet ? it clearly explains how to use IF command.

below will work for you

@echo off
findstr /i "XP" C:\temp.txt
if %errorlevel% == 0 c:\xp.txt
if %errorlevel% == 1 echo srting not found....


I guess you should go through

this article

Subhash Chandra.

Report •

February 28, 2011 at 22:07:58

Its working....................

Report •

Ask Question