|
Answer» Hi i'm trying to make a batch file to find the unique GUID of an account in windows xp. I'm able to use reg query and finstr to get a txt file with this :
Default User IDREG_SZ{30D58BD6-739C-4333-9AA4-8A8B3CCEC613}
How can i extract the GUID {30D58BD6-739C-4333-9AA4-8A8B3CCEC613} from this text file? Thank youWithout knowing the exact reg and findstr instructions you used, we can only offer a generic ANSWER:
Code: [Select]@echo off for /f "tokens=5" %%i in (reg query ... | findstr ...) do echo %%i
By wrapping your instructions in a for instruction, you should be able to parse out the GUID which is the 5th token in Default User ID REG_SZ {30D58BD6-739C-4333-9AA4-8A8B3CCEC613}
Good LUCK.
Be SURE to replace the ... with actual values.Hi thank you for the reply. I'm not so good in batch scripting so i tried to use your suggestion with this: Code: [Select]for /f "tokens=5" %%i in ('reg query HKCU\Identities\|findstr /C:" Default User ID"') do echo %%iBut the result is | not expected What is the problem? If i use the pipe with this Code: [Select]reg query HKCU\Identities\|findstr /C:" Default User ID">example.txtit works.... I'm confused
inside the for loop it must be "^|"
Code: [Select]for /f "tokens=5" %%i in ('reg query HKCU\Identities\ ^|findstr /C:" Default User ID"') do echo %%i FBThank you all, it works. Can someone drive me to some web resources to learn how to use dos commands? Using the explanation of cmd is useful but without examples it is DIFFICULT to understand. For example why do i have to use %%i in batch files but if i use it directly in the commnad window i have to use %i ?I'm trying to edit the windows registry with this cmd file: Code: [Select]@for /f "tokens=5" %%i in ('reg query HKCU\Identities\^|findstr /C:" Default User ID"') do @set guid=%%i reg add HKEY_CURRENT_USER\Identities\%guid%\Software\Microsoft\Outlook Express\5.0 /v Launch Inbox /t REG_DWORD /d 0 /fBut when i launch the .cmd files it says :
Error: too many parameters from command line
Solved: sorry for being a newbie : keys with spaces NEED ""
Thank you all
|