August 7, 200521 yr no S-1-5-xx is not unique...just the characters after it...the reason for temp.txt is so you can set a variable...the for command wont work any other way...and i dont know of another method for setting a variable.
August 7, 200521 yr Author No no it's cool I was just wondering since you did not use a .txt in the example:for /f "tokens=5 skip=2" %%i in ('reg query HKCU\Identities /v "Default User ID"') do set Identity=%%iDo you know what the key S-1-5-21 is?
August 7, 200521 yr as far as what it pertains to on the system, no...but i do know I have a S-1-5-21 key, so do you, from your quote in the first post, and so does every other pc ive ever been on...as I edited in my post before, I said what keys are under HKU, I have not seen more or less, just those...and the S-1-5-21 keys are the only ones different and thats only cuz of the characters after it...I could tell you what my key is, but its not gonna be the same as yours...Also, the reason a temp.txt was not needed for Identities was because we didnt need to use |...Also, another reason is because in the example I was able to use the full subkey...whereas, since we do not know what the FULL subkey will be from pc to pc, I have to pull all subkeys, find the one we want, and set it to a variable. Edited August 7, 200521 yr by evilvoice
August 7, 200521 yr Author That clears it all up. Learning a new thing every day Thank's again for your efford!
August 7, 200521 yr now, your gonna have to figure out what the reg add command you need to add...cuz I cant really tell if Gestures is a keyname or subkey from your quote...but if you open regedit and a cmd window and do a reg add /? you should be able to come up with the right command. Edited August 7, 200521 yr by evilvoice
August 7, 200521 yr Thanks man. This helps alot! One thing though, why do I need to make the temp.txt?Also is not S-1-5-XX really unique?<{POST_SNAPBACK}>@echo offfor /f "delims=\ tokens=2" %%i in ('reg query HKU ^| findstr /V /E Classes ^| findstr "S-1-5-21"') do (set SID=%%i)&(echo. your Security ID is %SID%)What is a SID (Security ID)? Edited August 7, 200521 yr by Bilou_Gateux
August 7, 200521 yr ya know, where were you before I did all that work??? LOL...good job, so ^ is like an escape character.
August 7, 200521 yr I agree with you, you have done all the job.i must admit i'm very bad in batch scripting (noob?) but i use a very good reference:Rob van der Woude's Scripting PagesNote the use of carets as escape characters for the pipe symbols within the brackets of the FOR loop! Edited August 7, 200521 yr by Bilou_Gateux
August 7, 200521 yr LOL i did not mean it that way...just saying that it was nice to get a full method going...I really wasnt even going to work on it today, but I decided I had some time...I just assumed you already had the method...though there is always a chance to learn...I had no idea about the ^...hell that would save a lot of my temp.txt's running around...
August 7, 200521 yr Author Thanks man. This helps alot! One thing though, why do I need to make the temp.txt?Also is not S-1-5-XX really unique?<{POST_SNAPBACK}>@echo offfor /f "delims=\ tokens=2" %%i in ('reg query HKU ^| findstr /V /E Classes ^| findstr "S-1-5-21"') do (set SID=%%i)&(echo. your Security ID is %SID%)What is a SID (Security ID)?<{POST_SNAPBACK}>Actually that did just output "your security ID is"
August 7, 200521 yr Author I think you should not have included the ()This seems to work@echo offfor /f "delims=\ tokens=2" %%i in ('reg query HKU ^| findstr /V /E Classes ^| findstr "S-1-5-21"') do set SID=%%iecho %SID%exit
August 7, 200521 yr Code deleted, please see the updated version. Edited August 9, 200521 yr by Yzöwl
August 7, 200521 yr Author Am I doing something wrong? This pasted into a .cmd outputs nothing and closes the window.
August 7, 200521 yr if you're not working in a cmd window when you run it, then change the last line topause&endlocal&goto :eof<Edit>If you're running as the Administrator, the SID key always ends in -500</Edit> Edited August 7, 200521 yr by Yzöwl
Create an account or sign in to comment