5 pts.
 .Bat that extracts an specific regsitry key (SID) to a .txt or .reg file
Hello, how can i extract only the exact SID key from the registry with a .bat like this: ExtractSID.bat: REG QUERY HKU |Findstr /R "DEFAULT S-1-5-[0-9]*-[0-9-]*$" >> SID.txt With result on file SID.txt: HKEY_USERS.DEFAULT HKEY_USERSS-1-5-21-57989841-484763869-1957994488-1003 What i need on SID.txt: S-1-5-21-57989841-484763869-1957994488-1003

Software/Hardware used:
ASKED: March 7, 2008  4:53 AM
UPDATED: March 7, 2008  11:32 PM

Answer Wiki:
You may want to look into using the FOR command to process the SID.txt file line by line looking for the line which doesn't end in .DEFAULT. Something like (this isn't tested): <pre>FOR /F "delims= skip=1 tokens1,2" %%a in (SID.txt) do echo %%b > SID.txt</pre>
Last Wiki Answer Submitted:  March 7, 2008  8:19 am  by  Denny Cherry   64,520 pts.
All Answer Wiki Contributors:  Denny Cherry   64,520 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Add a line that filters using the FIND command to exclude lines with a specific string in them.

type SID.txt | find /v /i “default” >ONLY_SID.txt

The /v tells FIND to ignore the string “default” and the /i makes it case insensitive.

 85 pts.

 

Just to add to Mrdenny’s answer…check out this site for some great command line reference.

 45 pts.