Outputting a desired string

Acer Aspire 5920g
July 31, 2010 at 22:43:29
Specs: Microsoft Windows 7 Professional, 2.201 GHz / 2046 MB
Hello guys i am checking for EnabledGuestAccount settings from a text file. There will be two results which is EnabledGuestAccount = 0 or EnabledGuestAccount = 1.
Basically i would like my batch file to a line of string "EnabledGuestAccount = Disabled" when it is = EnabledGuestAccount = 0 is found and "EnabledGuestAccount = Enabled" when it is = 1...thanks in advance!


Command
findstr /i /C:"EnableGuestAccount " C:\major_security_settings1.txt


See More: Outputting a desired string

Report •

#1
August 1, 2010 at 08:14:18
Is it 'EnabledGuestAccount'or 'EnableGuestAccount'?
I've gone with EnabledGuestAccount...

@echo off

findstr /i /C:"EnabledGuestAccount = 1" C:\major_security_settings1.txt> nul
if %errorlevel% neq 1 (
  echo EnabledGuestAccount = Enabled
) else (
  echo EnabledGuestAccount = Disabled
)


Report •

#2
August 2, 2010 at 21:36:49
thank you very much!

Report •
Related Solutions


Ask Question