cyberyeye Posted April 5, 2006 Posted April 5, 2006 Hi ^^I've tried to make a batch (cmd file) for:- finding the automatically the value of "PerPassportSettings" from the registry- settings this "PerPassportSettings" into my batch with query command (or other command of course ^^).Unafortunatly my skill in batch programming is limited, so I need a little bit of help Into registry: PerPassportSettings is here:HKCU\Software\Microsoft\MSNMessenger\PerPassportSettings\here the number to findNote: here the number to find is the value of "PerPassportSettings"I would like to retrieve this key into my batch for settings msn automatically. Something like this sample i've done (but this don't work).for /f "Tokens=5" %%i in ('REG QUERY HKCU\Software\Microsoft\MSNMessenger /v "Key"^|find "Default"') do set key=%%iREG ADD "HKCU\Software\Microsoft\MSNMessenger\%key%" /v "DisableTabs" /t REG_DWORD /d 00000001 /fIn RED i've marked what I think is wrong (probably all this script is wrong lol).-> This script is execute during runonceex.cmd just after msn 7.5 installation...Yzöwl or other master of art in batch coding...Pleeeaase help O_O
Yzöwl Posted April 5, 2006 Posted April 5, 2006 It can be dependent upon the content of your other sub-keys and since I do not have MSN, I cannot test the following code, however I am led to believe that the key you are after is numeric only, therefore @ECHO OFF &SETLOCAL SET "PARTKEY=HKCU\Software\Microsoft\MSNMessenger\PerPassportSettings" FOR /F "DELIMS=" %%? IN ('REG QUERY "%PARTKEY%" /S ^|FINDSTR "\\[0-9]*$" ^2^>NUL') DO IF ERRORLEVEL 0 (SET FULLKEY=%%?) IF DEFINED FULLKEY ( echo/REG ADD "%FULLKEY%" /V DisableTabs /T REG_DWORD /D 1 /F) ENDLOCAL &GOTO :EOFIf you are happy with the result, remove echo/ from line 5.Note, in order to identify line wrap, I have indented each line with two spaces, any line therefore not starting with two spaces has wrapped.
cyberyeye Posted April 5, 2006 Author Posted April 5, 2006 Yeess !!!This is exactly what i was trying to do I've made a quick test with this:@ECHO OFF &SETLOCALSET "PARTKEY=HKCU\Software\Microsoft\MSNMessenger\PerPassportSettings"FOR /F "DELIMS=" %%? IN ('REG QUERY "%PARTKEY%" /S ^|FINDSTR "\\[0-9]*$" ^2^>NUL') DO IF ERRORLEVEL 0 (SET FULLKEY=%%?)IF DEFINED FULLKEY (REG ADD "%FULLKEY%" /V Toto /T REG_DWORD /D 1 /F)ENDLOCAL &GOTO :EOFAnd "toto" is add at the right place in my case:HKEY_CURRENT_USER\Software\Microsoft\MSNMessenger\PerPassportSettings\2239632blablaSo it works, and works well :-)Now we can add regtweak for msn messenger "fully unattended" !What to says ? Uhhh maybe.... big big thanks Yzöwl you rocks ^__^
Yzöwl Posted April 5, 2006 Posted April 5, 2006 If only people outside of my computer appreciated me as much as people on itThen again, if that were the case, I probably wouldn't be here now!Lets just smile and celebrate the fact that Yzöwl has no real friends
cyberyeye Posted April 5, 2006 Author Posted April 5, 2006 [mode troll=on]LOL An advice (not really serious) ^^1. Buy a T-Shirt with "If you're a girl and panic with computing: I'm you're solution"2. Buy a bottle of Champagne and create an association for "girl looking for fine lesson in computing"3. Put the bottle (and candle and so on...) on a nice table near the computer.Now you can say carefully to the girl, sorry computer has crashed, but... We still have Champagne and candle ^^Isnt' it a beautiful solution ?[mode troll=off]Seriously (can it be ?)Here's my script for msn 7.5, if anyone had headache with this in the past (me ? no, no, no: never ^^), now we have what we were looking for.cmdow @ /HIDSETLOCALSET "PARTKEY=HKCU\Software\Microsoft\MSNMessenger\PerPassportSettings"FOR /F "DELIMS=" %%? IN ('REG QUERY "%PARTKEY%" /S ^|FINDSTR "\\[0-9]*$" ^2^>NUL') DO IF ERRORLEVEL 0 (SET FULLKEY=%%?)IF DEFINED FULLKEY (REG ADD "%FULLKEY%" /V DisableIntro /T REG_BINARY /D 01000000 /FREG ADD "%FULLKEY%" /V DisableMSNToday /T REG_BINARY /D 01000000 /FREG ADD "%FULLKEY%" /V DisableTabs /T REG_DWORD /D 1 /FREG ADD "%FULLKEY%" /V PerPassportAppSettings /T REG_DWORD /D 1 /FREG ADD "%FULLKEY%" /V UsedGroupsView /T REG_DWORD /D 1 /FREG ADD "%FULLKEY%\GroupState" /V .ViewByOnline /T REG_DWORD /D 1 /F)SET "MSN=HKCU\Software\Microsoft\MSNMessenger"IF DEFINED MSN (REG ADD "%MSN%" /V DirectIM /T REG_BINARY /D 00000000 /FREG ADD "%MSN%" /V FirstTimeUser /T REG_DWORD /D 0 /FREG ADD "%MSN%" /V MainFrameHidden /T REG_BINARY /D 00000000 /F)ENDLOCAL &GOTO :EOFsettings usefull is:DisableMSNTodayDisableTabsFirstTimeUserYzöwl: Should i says thanks again ?Definitevely: yeeesssPS: You find this script useful ? So... Feel free to send Champagne to Yzöwl, now he know what to do with this french liquid ^^
Djé Posted April 6, 2006 Posted April 6, 2006 FOR /F "DELIMS=" %%? IN ('REG QUERY "%PARTKEY%" /S ^|FINDSTR "\\[0-9]*$" ^2^>NUL') DO ...No way !Regexp in my batches?!? I'm learning every day.Have to find out about those escaping ^, tho. Why and where do I need them? My friend?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now