Execute command based on txt file contents

July 10, 2009 at 21:04:53
Specs: Windows Vista
I have a text file that some times has "Cisco
VPN adapter" in it. My goal is to execute a
command based on if it is there or not. I need
this to work in dos the goal is to turn off a
service when the string is detected and turn on
the service if the string is not detected. i have
worked hard on the first half of the code and
just need help with this second half. trying to
do this all in NT DOS batch. Thanks in

See More: Execute command based on txt file contents

Report •

July 10, 2009 at 23:33:50
@echo off & setLocal EnableDelayedExpansion

find "CiscoVPN adapter" < myfile > nul
if errorlevel 1 (
echo turn on
) else (
echo turn off

If at first you don't succeed, you're about average.


Report •
Related Solutions

Ask Question