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
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.
Just to add to Mrdenny’s answer…check out this site for some great command line reference.