I'm trying to compile a batch file to get the userID of the current user, then use the output to delete a certain registry key.
I found this to get the SID of the current logged in user:
wmic useraccount where name='%username%' get sid
This worked perfectly and gave me:
SID
S-1-5-21-XXXXX-XXXXX-XXXX-XXX
Now I would like to use the S-1-5-21.... etc. To delete a certain registry key for the current logged in user, so the S-1-5-21 etc. How can I do that? Or is there an easier way, being able to determine current SID and delete a key consequently?
thank you!