|hey sorry to trouble you guys but can i ask|
is there anyway to filter out only the
BUILTIN\Administrator line and its atttributes
to a text file?
You can try the code below. Not sure if it's ultimately what
you want though. Did you check out the link that Razor
posted in Response # 17? How does that change things?
EDIT: I've just noticed that, although the code works
here on the file that you uploaded,
if you edit it in the slightest way, it all goes
pear-shaped. Not sure what's going on there,
can't figure it out, but probably best that you
give it a miss :)
type nul> "%OutFile%"
for /f "tokens=1 delims=:" %%a in ('findstr /n /c:"BUILTIN\Administrators:(special access:)" "%InFile%"') do set DataStart=%%a
for /f "tokens=1 delims=:" %%a in ('findstr /r /n /c:"^[ ]*$" "%InFile%"') do (
if !DataEnd! gtr %DataStart% goto LineNumbersDone
for /f "tokens=1* delims=:" %%a in ('findstr /r /n ".*" "%InFile%"') do (
if %%a geq %DataStart% if %%a lss %DataEnd% echo %%b>> "%OutFile%"
The logic is to find the line numbers where the data
starts and ends, using a blank line or - as it is in this
case - a line with only spaces to mark the end of
the data, then print out the lines in that range.
Filenames are set to hi1.txt (which is what you
posted) for input and out.txt for the output.