标题: [注册表类] [已解决]批处理把快捷方式固定到开始菜单的注册表 超长字符串 [打印本页]
作者: smss 时间: 2020-7-1 01:56 标题: [已解决]批处理把快捷方式固定到开始菜单的注册表 超长字符串
- @Echo off
- for /f "delims=" %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount" /s^|find "$start.tilegrid$windows.data.curatedtilecollection.tilecollection\Current"') do reg add "%%i" /f /v "Data" /t REG_BINARY /d "020000008332676bd14ad60100000000434201000a0a00d0140cd01e04d02804ca3200cc8d1204267b00300038003900320032003000310042002d0031003300370045002d0034004600460044002d0038003900310034002d004300320033003500420045003800420045004300390039007d00267b00310035003400320035004500300036002d0032003500300044002d0034004500300044002d0039004600310045002d003000450037003200320035003700310046003600430032007d00267b00320042003900300034004500430037002d0043004100390042002d0034004100300045002d0038003200390043002d003900420039004300360034004500310034003400410046007d00267b00340035003900450038004500380034002d0032003400320038002d0034003900460033002d0039003200430045002d004600310041004500390033003200300044003600410036007d00e22c010100cd0a120a10267b00300043004400450046004600350039002d0038004100300032002d0034003600330033002d0039003800340033002d003400310030003300370041004500430034004100330043007d000a05d9fefb662482940244b38c01669887859aa08fbba53c00d20a4e50007e006d006900630072006f0073006f00660074002e00770069006e0064006f007700730063006f006d006d0075006e00690063006100740069006f006e00730061007000700073005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e00570069006e0064006f00770073004c006900760065002e004d00610069006c00ca14100400ca1e1008300400c2320100267b00300046003200410032004200460030002d0031004600350044002d0034003100460035002d0042004300410034002d004300300034003400330032003400460035003400300046007d000a05f0d7a87924dd3e44f5830166bcc982a6a4e693aa0f00d20a3750007e004d006900630072006f0073006f00660074002e005a0075006e00650056006900640065006f005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e005a0075006e00650056006900640065006f00ca14100400ca1e1004300400c2320100267b00320030003700350041003000340039002d0041003800330042002d0034003500460034002d0039003600370034002d003500390034003900440031003100410037003000310044007d000a05c9c0d6830224bbd00244f48b016696e9e5ca94da86b81d00d20a2157007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e00570049004e0057004f00520044002e004500580045002e0031003500ca141008300400ca1e1004300400c2320100267b00320032003100380033004500330044002d0039004100460032002d0034004400440043002d0042003300380039002d003500370044003200430036003600370042003400450033007d000a05bdfce0900224f2b50244dc9b0166b393de92edf899dae30100d20a4950007e004d006900630072006f0073006f00660074002e004d006900630072006f0073006f00660074004f00660066006900630065004800750062005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e004d006900630072006f0073006f00660074004f0066006600690063006500480075006200ca141004300400ca1e1004300400c2320100267b00330039004200370034003100420034002d0045003000350042002d0034004100420030002d0039003300460041002d003600300038003800420031004200380039004500420038007d000a05b483ddcd0324dbc00344b095016693f583c39896aecfb80100d20a4e57007e007b00310041004300310034004500370037002d0030003200450037002d0034004500350044002d0042003700340034002d003200450042003100410045003500310039003800420037007d005c00570069006e0064006f007700730050006f007700650072005300680065006c006c005c00760031002e0030005c0070006f007700650072007300680065006c006c002e00650078006500ca14300400ca1e1004300400c2320100267b00330041003100410036003600410030002d0037004600310035002d0034003800460038002d0039004200320038002d003200300035003400390044004100370046003200430044007d000a05a0cde9d0032495fe0144f89101669bd180a1d5f3a9f9cd0100d20a2f50007e004d006900630072006f0073006f00660074002e00570069006e0064006f0077007300430061006c00630075006c00610074006f0072005f003800770065006b007900620033006400380062006200770065002100410070007000ca1400ca1e1004300400c2320100267b00350039004500390030003000390045002d0044003600460046002d0034003900370033002d0041004500460037002d003900310038004500410045004600460032003200390045007d000a059e81a4cf0524ffad0344f3920166aeefc7f4e8f5bf919e0100d20a1f57007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e0045005800430045004c002e004500580045002e0031003500ca14300400ca1e1004300400c2320100267b00350042004500300045003600440043002d0033003700310045002d0034003600300044002d0038004100310036002d004100420033003800340042004300460030004100300030007d000a05dccd83df05249e6e448d8c01668aadacc5b3e9b30500d20a3350007e004d006900630072006f0073006f00660074002e004d0053005000610069006e0074005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e004d0053005000610069006e007400ca14100800ca1e1004300400c2320100267b00360044003500360044004100450042002d0037004500330039002d0034003600410037002d0039003600380035002d003600380039003000330037003000460034003800460044007d000a05ebb5dbea0624b9fc0144a78d0166968ba283f9e683a4fd0100d20a2b50007e004d006900630072006f0073006f00660074002e00570069006e0064006f0077007300430061006d006500720061005f003800770065006b007900620033006400380062006200770065002100410070007000ca14100400ca1e1004300400c2320100267b00370041004100450043004300320033002d0031004300450043002d0034004300430045002d0038003400440046002d003800350034004400350045003200410037003500320045007d000a05a398bbd50724ec3944ce99016684bf97ece4cbcaba2e00d20a3350007e004d006900630072006f0073006f00660074002e00580062006f0078004100700070005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e00580062006f007800410070007000ca1400ca1e1004300400c2320100267b00370046003000310043004200300030002d0045004400390034002d0034003600330032002d0038003600440045002d003000370044003100450046004600430042004500300031007d000a05809687f8072494db0344b28c016686bd9f88fd9dbfdf0100d20a3550007e004d006900630072006f0073006f00660074002e004d006900630072006f0073006f006600740045006400670065005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074004500640067006500ca14100800ca1e1004300400c2320100267b00390036004600320030003000330033002d0042004300460038002d0034003200390033002d0039003400460045002d004400430045004300360037003500450030003800420035007d000a05b380c8b70924f8f902449385016694fdf3e6fecc9784b50100d20a2257007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e0050004f0057004500520050004e0054002e004500580045002e0031003500ca141008300400ca1e1004300400c2320100267b00390045003500450042003400330043002d0030003400320033002d0034004500390034002d0038004600360046002d004300330042003900440044004100350031003500410044007d000a05bce8faf20924a30844949d01668fdf8dcedbbbe98aad0100d20a5250007e006d006900630072006f0073006f00660074002e00770069006e0064006f007700730063006f006d006d0075006e00690063006100740069006f006e00730061007000700073005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e00570069006e0064006f00770073004c006900760065002e00430061006c0065006e00640061007200ca1400ca1e1004300400c2320100267b00440044003900390038003400350034002d0045003100370034002d0034003200430036002d0042003100440044002d004100340032003000420033004100340044003200320044007d000a05d488e6ec0d24f4c20344c6850166b1bb9385b296a9e92d00d20a3c50007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e004f006e0065004e006f00740065005f003800770065006b0079006200330064003800620062007700650021006d006900630072006f0073006f00660074002e006f006e0065006e006f007400650069006d00ca141004300400ca1e1004300400c2320100267b00460034003900380042003300310035002d0044003400410038002d0034003400320046002d0041004600300034002d003700300037003100370042004300380044003700310041007d000a0595e6e2a40f24a8a90344af880166af89c08bb78ff2eb1a00d20a2c50007e004d006900630072006f0073006f00660074002e00570069006e0064006f00770073002e00500068006f0074006f0073005f003800770065006b007900620033006400380062006200770065002100410070007000ca14100800ca1e1004300400c2320100267b00460043003100460043003100410038002d0043003200430042002d0034004200380044002d0039003900310041002d003200420045004300390033003300450035004200370042007d000a05a883ffe00f24cb8503448d97016699b5ace1bed2cfad7b00d20a2a50007e004d006900630072006f0073006f00660074002e00570069006e0064006f0077007300530074006f00720065005f003800770065006b007900620033006400380062006200770065002100410070007000ca1400ca1e1008300400c2320100cd14120a04267b00300038003900320032003000310042002d0031003300370045002d0034004600460044002d0038003900310034002d004300320033003500420045003800420045004300390039007d000a059bc0c84424fe2644fd9f016689a988aee3f7a2f6990100d20a02315a504eca1e100200cc3d1206267b00300046003200410032004200460030002d0031004600350044002d0034003100460035002d0042004300410034002d004300300034003400330032003400460035003400300046007d00267b00350039004500390030003000390045002d0044003600460046002d0034003900370033002d0041004500460037002d003900310038004500410045004600460032003200390045007d00267b00370041004100450043004300320033002d0031004300450043002d0034004300430045002d0038003400440046002d003800350034004400350045003200410037003500320045007d00267b00390036004600320030003000330033002d0042004300460038002d0034003200390033002d0039003400460045002d004400430045004300360037003500450030003800420035007d00267b00440044003900390038003400350034002d0045003100370034002d0034003200430036002d0042003100440044002d004100340032003000420033004100340044003200320044007d00267b00460034003900380042003300310035002d0044003400410038002d0034003400320046002d0041004600300034002d003700300037003100370042004300380044003700310041007d00ca500000267b00310035003400320035004500300036002d0032003500300044002d0034004500300044002d0039004600310045002d003000450037003200320035003700310046003600430032007d000a0586bc89aa01248d4a448d9c01669fbdb890d7a49cfbc20100ca1e1002300a00cc3d1203267b00330041003100410036003600410030002d0037004600310035002d0034003800460038002d0039004200320038002d003200300035003400390044004100370046003200430044007d00267b00350042004500300045003600440043002d0033003700310045002d0034003600300044002d0038004100310036002d004100420033003800340042004300460030004100300030007d00267b00360044003500360044004100450042002d0037004500330039002d0034003600410037002d0039003600380035002d003600380039003000330037003000460034003800460044007d00ca500000267b00320042003900300034004500430037002d0043004100390042002d0034004100300045002d0038003200390043002d003900420039004300360034004500310034003400410046007d000a05c79dc1dc02249b9503448e94016682b9eee4c9acb8a2af0100d20a024f6dc889ca1e300a00cc3d1202267b00370046003000310043004200300030002d0045004400390034002d0034003600330032002d0038003600440045002d003000370044003100450046004600430042004500300031007d00267b00460043003100460043003100410038002d0043003200430042002d0034004200380044002d0039003900310041002d003200420045004300390033003300450035004200370042007d00ca500000267b00340035003900450038004500380034002d0032003400320038002d0034003900460033002d0039003200430045002d004600310041004500390033003200300044003600410036007d000a05849dfaac0424a84844f3930166929dc7f7ba9288eba60100d20a021b52fa5eca1e00cc3d1205267b00300043004400450046004600350039002d0038004100300032002d0034003600330033002d0039003800340033002d003400310030003300370041004500430034004100330043007d00267b00320030003700350041003000340039002d0041003800330042002d0034003500460034002d0039003600370034002d003500390034003900440031003100410037003000310044007d00267b00320032003100380033004500330044002d0039004100460032002d0034004400440043002d0042003300380039002d003500370044003200430036003600370042003400450033007d00267b00330039004200370034003100420034002d0045003000350042002d0034004100420030002d0039003300460041002d003600300038003800420031004200380039004500420038007d00267b00390045003500450042003400330043002d0030003400320033002d0034004500390034002d0038004600360046002d004300330042003900440044004100350031003500410044007d00ca50000000"
- taskkill /f /im explorer.exe&start explorer.exe
- pause
复制代码
逆向手动导出该值 方便用作下次使用
作者: WHY 时间: 2020-7-1 11:53
本帖最后由 WHY 于 2020-7-1 13:22 编辑
那一长串二进制类型值已经超出批处理单行长度范围了(大概8190个字符)。批处理表示对此无能为力,你可以事先写入注册表文件,然后用 regedit 导入,或者寻求其它解决办法。
PowerShell 脚本可以这样:- $value = '020000008332676bd14ad601000000004342'; #这里是一长串 Binary 类型值
- $value = [regex]::Matches($value, '..').Value | %{ [char]( 1*('0x'+$_) ) }; #转换为 char类型数组
-
- dir -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion' -Include '*$start.tilegrid$windows.data.curatedtilecollection.tilecollection*' -Recurse | %{
- $path = $_.PSPath + '\Current';
- if( !(Test-Path $path) ){ $null = md $path; }
- set-ItemProperty -Path $Path -Name 'Data' -Value $value -Type Binary -Force;
- }
- pause
复制代码
作者: smss 时间: 2020-7-1 12:27
回复 2# WHY
不行没有真正导入 手动可以- reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\$de${864ea5eb-0434-4cc6-9646-962c60f3cf49}$start.tilegrid$windows.data.curatedtilecollection.tilecollection\Current" /f /v "Data" /t REG_BINARY /d 020000000ef60f0f5e4fd60100000000434201000a0a00d0140cd01e04d02804ca3200cc8d1202267b00340042004600320038003300440046002d0032003700380037002d0034003800460030002d0038004400340031002d003900320044003800300036003400390039004400430031007d00267b00390033003500430030004100360043002d0031004600410042002d0034003800390038002d0042004500410037002d004300350033003800420035003900300046003900330044007d00e22c010100cd0a120a0b267b00340042004200390037003500320031002d0033004300410035002d0034004600310032002d0041004600430030002d003300440041003500340046004200340035004500380046007d000a05a1eae5dd0424a57944929e0166af81f7a9fa89adaf8f0100d20a2257007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e0050004f0057004500520050004e0054002e004500580045002e0031003500ca141008300400ca1e1004300400c2320100267b00350038004200430035003800420035002d0032003400310036002d0034003800430045002d0039003100430046002d003000360036003500460030004200330037004500450041007d000a05b5b1f1c50524964844ce910166919f9ba886feacbfea0100d20a2f50007e004d006900630072006f0073006f00660074002e00570069006e0064006f0077007300430061006c00630075006c00610074006f0072005f003800770065006b007900620033006400380062006200770065002100410070007000ca141004300400ca1e1004300400c2320100267b00370034003000300046004100310042002d0030003700320046002d0034004600450033002d0039003600330044002d004100350037004600360043003800350041004500450031007d000a059bf483a00724af0e44e39f016696fb94fdc7ada1d7e10100d20a3350007e004d006900630072006f0073006f00660074002e004d0053005000610069006e0074005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e004d0053005000610069006e007400ca14300400ca1e1004300400c2320100267b00380041004200460030004100350046002d0035004200430045002d0034003100460030002d0042004200320038002d003900460030003500390039003700450030003600310038007d000a05df94fcd50824ceb70144f0830166bbd1fcac90d39f831800d20a2157007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e00570049004e0057004f00520044002e004500580045002e0031003500ca14100800ca1e1004300400c2320100267b00380042003300450037004100410038002d0037003600420039002d0034003500450033002d0038004400420032002d004500440035003800460035004500370045004400460039007d000a05a8f5f9d90824b9ed0144e38b01668de5b6c7d5fef9f6f90100d20a4950007e004d006900630072006f0073006f00660074002e004d006900630072006f0073006f00660074004f00660066006900630065004800750062005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e004d006900630072006f0073006f00660074004f0066006600690063006500480075006200ca14100400ca1e1004300400c2320100267b00380043004200380043004200450046002d0045004600360038002d0034003600300042002d0038004100360031002d003100330034004600320042003100300030003200360031007d000a05ef97e3e50824e8de03448b8c01668ac3cdf8b48584816100d20a2c50007e004d006900630072006f0073006f00660074002e00570069006e0064006f00770073002e00500068006f0074006f0073005f003800770065006b007900620033006400380062006200770065002100410070007000ca14100800ca1e1004300400c2320100267b00430032004300390034004100360033002d0032003200350030002d0034004200450035002d0038003500320038002d004600390041003700360032003900300044003200460046007d000a05e394a5960c24d04444e597016685d1e4bfaa8ca4e9ff0100d20a3550007e004d006900630072006f0073006f00660074002e004d006900630072006f0073006f006600740045006400670065005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074004500640067006500ca1400ca1e1004300400c2320100267b00440035004200360039003100380043002d0030003700320035002d0034003200410044002d0041004400300038002d003500460039003200310044003400450036004300320035007d000a058ca3daad0d24a50e44ad850166ad91fc92d9c393b62500d20a4e57007e007b00310041004300310034004500370037002d0030003200450037002d0034004500350044002d0042003700340034002d003200450042003100410045003500310039003800420037007d005c00570069006e0064006f007700730050006f007700650072005300680065006c006c005c00760031002e0030005c0070006f007700650072007300680065006c006c002e00650078006500ca141004300800ca1e1004300400c2320100267b00450031004200430034004500420033002d0046004100330035002d0034003200340036002d0039003200430038002d003300440034004500420033004100380041004600380043007d000a05b39df18d0e24b5f40344c68401669291f7f1b496ead78c0100d20a2b50007e004d006900630072006f0073006f00660074002e00570069006e0064006f0077007300430061006d006500720061005f003800770065006b007900620033006400380062006200770065002100410070007000ca141008300400ca1e1004300400c2320100267b00450044003100380032003000410031002d0039003000440044002d0034003900330030002d0038003700340037002d004200350046004200390044004600410034003400340037007d000a05a1c1e0e80e24dda10244b0920166878fd5dddfd3bea24700d20a3750007e004d006900630072006f0073006f00660074002e005a0075006e00650056006900640065006f005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e005a0075006e00650056006900640065006f00ca14100400ca1e1004300400c2320100267b00460043004600420045003100370036002d0037004600460030002d0034004400380045002d0041003300360043002d004600370042004100360041003500410032003200330035007d000a05f6c2efe70f24f0ff01448e9b0166a3d9ddd7abcd96913500d20a1f57007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e0045005800430045004c002e004500580045002e0031003500ca141004300400ca1e1004300400c2320100cd14120a06267b00310032003400350030003600370037002d0037003300330032002d0034004200340033002d0042004600320030002d003900370031003500330036004200330045003700430034007d000a05f78c94920124b2e60144c3960166bfc1dcace1e6ecf3c40100ca1e1002300a00ca500000267b00340042004600320038003300440046002d0032003700380037002d0034003800460030002d0038004400340031002d003900320044003800300036003400390039004400430031007d000a05df87cadf0424874f44f09101668d83c9c4eda0d2cec10100d20a02315a504eca1e100200cc3d1206267b00350038004200430035003800420035002d0032003400310036002d0034003800430045002d0039003100430046002d003000360036003500460030004200330037004500450041007d00267b00370034003000300046004100310042002d0030003700320046002d0034004600450033002d0039003600330044002d004100350037004600360043003800350041004500450031007d00267b00380043004200380043004200450046002d0045004600360038002d0034003600300042002d0038004100360031002d003100330034004600320042003100300030003200360031007d00267b00430032004300390034004100360033002d0032003200350030002d0034004200450035002d0038003500320038002d004600390041003700360032003900300044003200460046007d00267b00450031004200430034004500420033002d0046004100330035002d0034003200340036002d0039003200430038002d003300440034004500420033004100380041004600380043007d00267b00450044003100380032003000410031002d0039003000440044002d0034003900330030002d0038003700340037002d004200350046004200390044004600410034003400340037007d00ca500000267b00350038004500360044003200330035002d0034004500410035002d0034004200340045002d0038004200360046002d004100440044003200420045003300440032004400370036007d000a05b5a49bc70524a59d0144ce9601668bdfb595edb7cf967600ca1e300600ca500000267b00360034003200420045004500380043002d0043003500370043002d0034003300410039002d0039003500360042002d003000360043003400330034003900370035003800390045007d000a058cd**10624fc8a0344a987016695d799a0cce6a5ac9e0100ca1e300a00ca500000267b00380042003100430033003300460037002d0035004400320042002d0034003900380031002d0039003800430032002d003000350043003300390036004500420042003000350033007d000a05f7e7f0d80824abba01448193016698859798ecf2bad85300d20a024f6dc889ca1e300600ca500000267b00390033003500430030004100360043002d0031004600410042002d0034003800390038002d0042004500410037002d004300350033003800420035003900300046003900330044007d000a05ec94f09a0924ab3f4498910166becf96c6d396e4fc3d00d20a021b52fa5eca1e00cc3d1205267b00340042004200390037003500320031002d0033004300410035002d0034004600310032002d0041004600430030002d003300440041003500340046004200340035004500380046007d00267b00380041004200460030004100350046002d0035004200430045002d0034003100460030002d0042004200320038002d003900460030003500390039003700450030003600310038007d00267b00380042003300450037004100410038002d0037003600420039002d0034003500450033002d0038004400420032002d004500440035003800460035004500370045004400460039007d00267b00440035004200360039003100380043002d0030003700320035002d0034003200410044002d0041004400300038002d003500460039003200310044003400450036004300320035007d00267b00460043004600420045003100370036002d0037004600460030002d0034004400380045002d0041003300360043002d004600370042004100360041003500410032003200330035007d00ca50000000
- taskkill /f /im explorer.exe&start explorer.exe
复制代码
作者: WHY 时间: 2020-7-1 13:29
回复 3# smss
你把第一行复制粘贴到 cmd 命令行,不要回车,看看 /d 后面显示的全不全?
因为cmd自动截取了 /d 后面的值,所以可以成功运行,但写入到注册表的值肯定是错误的。
作者: smss 时间: 2020-7-1 20:27
回复 4# WHY
不全只到第二个100380043002d0030003700320035002d0034003200410044002d0041004400300038002d00350046003900320031004
作者: smss 时间: 2020-7-2 12:59
本帖最后由 smss 于 2020-7-2 13:02 编辑
回复 4# WHY
只能这样曲线救国吗 大神肯定有完美方法 VBS支持上亿字符串 仅仅变更一下前边的就不行而这样可以 真是奇了怪了- ::固定到开始菜单
- for /f "delims=" %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount" /s^|find "$start.tilegrid$windows.data.curatedtilecollection.tilecollection\Current"') do (
- PowerShell "$s=[IO.File]::ReadAllText('%~dp0开始菜单.cmd', [Text.Encoding]::Default) -replace '替换', '%%i';[IO.File]::WriteAllText('%TEMP%\1.cmd', $s, [Text.Encoding]::Default)"
- )
- call %TEMP%\1.cmd&del %TEMP%\1.cmd
复制代码
开始菜单.cmd- reg add "替换" /f /v "Data" /t REG_BINARY /d 020000000ef60f0f5e4fd60100000000434201000a0a00d0140cd01e04d02804ca3200cc8d1202267b00340042004600320038003300440046002d0032003700380037002d0034003800460030002d0038004400340031002d003900320044003800300036003400390039004400430031007d00267b00390033003500430030004100360043002d0031004600410042002d0034003800390038002d0042004500410037002d004300350033003800420035003900300046003900330044007d00e22c010100cd0a120a0b267b00340042004200390037003500320031002d0033004300410035002d0034004600310032002d0041004600430030002d003300440041003500340046004200340035004500380046007d000a05a1eae5dd0424a57944929e0166af81f7a9fa89adaf8f0100d20a2257007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e0050004f0057004500520050004e0054002e004500580045002e0031003500ca141008300400ca1e1004300400c2320100267b00350038004200430035003800420035002d0032003400310036002d0034003800430045002d0039003100430046002d003000360036003500460030004200330037004500450041007d000a05b5b1f1c50524964844ce910166919f9ba886feacbfea0100d20a2f50007e004d006900630072006f0073006f00660074002e00570069006e0064006f0077007300430061006c00630075006c00610074006f0072005f003800770065006b007900620033006400380062006200770065002100410070007000ca141004300400ca1e1004300400c2320100267b00370034003000300046004100310042002d0030003700320046002d0034004600450033002d0039003600330044002d004100350037004600360043003800350041004500450031007d000a059bf483a00724af0e44e39f016696fb94fdc7ada1d7e10100d20a3350007e004d006900630072006f0073006f00660074002e004d0053005000610069006e0074005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e004d0053005000610069006e007400ca14300400ca1e1004300400c2320100267b00380041004200460030004100350046002d0035004200430045002d0034003100460030002d0042004200320038002d003900460030003500390039003700450030003600310038007d000a05df94fcd50824ceb70144f0830166bbd1fcac90d39f831800d20a2157007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e00570049004e0057004f00520044002e004500580045002e0031003500ca14100800ca1e1004300400c2320100267b00380042003300450037004100410038002d0037003600420039002d0034003500450033002d0038004400420032002d004500440035003800460035004500370045004400460039007d000a05a8f5f9d90824b9ed0144e38b01668de5b6c7d5fef9f6f90100d20a4950007e004d006900630072006f0073006f00660074002e004d006900630072006f0073006f00660074004f00660066006900630065004800750062005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e004d006900630072006f0073006f00660074004f0066006600690063006500480075006200ca14100400ca1e1004300400c2320100267b00380043004200380043004200450046002d0045004600360038002d0034003600300042002d0038004100360031002d003100330034004600320042003100300030003200360031007d000a05ef97e3e50824e8de03448b8c01668ac3cdf8b48584816100d20a2c50007e004d006900630072006f0073006f00660074002e00570069006e0064006f00770073002e00500068006f0074006f0073005f003800770065006b007900620033006400380062006200770065002100410070007000ca14100800ca1e1004300400c2320100267b00430032004300390034004100360033002d0032003200350030002d0034004200450035002d0038003500320038002d004600390041003700360032003900300044003200460046007d000a05e394a5960c24d04444e597016685d1e4bfaa8ca4e9ff0100d20a3550007e004d006900630072006f0073006f00660074002e004d006900630072006f0073006f006600740045006400670065005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074004500640067006500ca1400ca1e1004300400c2320100267b00440035004200360039003100380043002d0030003700320035002d0034003200410044002d0041004400300038002d003500460039003200310044003400450036004300320035007d000a058ca3daad0d24a50e44ad850166ad91fc92d9c393b62500d20a4e57007e007b00310041004300310034004500370037002d0030003200450037002d0034004500350044002d0042003700340034002d003200450042003100410045003500310039003800420037007d005c00570069006e0064006f007700730050006f007700650072005300680065006c006c005c00760031002e0030005c0070006f007700650072007300680065006c006c002e00650078006500ca141004300800ca1e1004300400c2320100267b00450031004200430034004500420033002d0046004100330035002d0034003200340036002d0039003200430038002d003300440034004500420033004100380041004600380043007d000a05b39df18d0e24b5f40344c68401669291f7f1b496ead78c0100d20a2b50007e004d006900630072006f0073006f00660074002e00570069006e0064006f0077007300430061006d006500720061005f003800770065006b007900620033006400380062006200770065002100410070007000ca141008300400ca1e1004300400c2320100267b00450044003100380032003000410031002d0039003000440044002d0034003900330030002d0038003700340037002d004200350046004200390044004600410034003400340037007d000a05a1c1e0e80e24dda10244b0920166878fd5dddfd3bea24700d20a3750007e004d006900630072006f0073006f00660074002e005a0075006e00650056006900640065006f005f003800770065006b0079006200330064003800620062007700650021004d006900630072006f0073006f00660074002e005a0075006e00650056006900640065006f00ca14100400ca1e1004300400c2320100267b00460043004600420045003100370036002d0037004600460030002d0034004400380045002d0041003300360043002d004600370042004100360041003500410032003200330035007d000a05f6c2efe70f24f0ff01448e9b0166a3d9ddd7abcd96913500d20a1f57007e004d006900630072006f0073006f00660074002e004f00660066006900630065002e0045005800430045004c002e004500580045002e0031003500ca141004300400ca1e1004300400c2320100cd14120a06267b00310032003400350030003600370037002d0037003300330032002d0034004200340033002d0042004600320030002d003900370031003500330036004200330045003700430034007d000a05f78c94920124b2e60144c3960166bfc1dcace1e6ecf3c40100ca1e1002300a00ca500000267b00340042004600320038003300440046002d0032003700380037002d0034003800460030002d0038004400340031002d003900320044003800300036003400390039004400430031007d000a05df87cadf0424874f44f09101668d83c9c4eda0d2cec10100d20a02315a504eca1e100200cc3d1206267b00350038004200430035003800420035002d0032003400310036002d0034003800430045002d0039003100430046002d003000360036003500460030004200330037004500450041007d00267b00370034003000300046004100310042002d0030003700320046002d0034004600450033002d0039003600330044002d004100350037004600360043003800350041004500450031007d00267b00380043004200380043004200450046002d0045004600360038002d0034003600300042002d0038004100360031002d003100330034004600320042003100300030003200360031007d00267b00430032004300390034004100360033002d0032003200350030002d0034004200450035002d0038003500320038002d004600390041003700360032003900300044003200460046007d00267b00450031004200430034004500420033002d0046004100330035002d0034003200340036002d0039003200430038002d003300440034004500420033004100380041004600380043007d00267b00450044003100380032003000410031002d0039003000440044002d0034003900330030002d0038003700340037002d004200350046004200390044004600410034003400340037007d00ca500000267b00350038004500360044003200330035002d0034004500410035002d0034004200340045002d0038004200360046002d004100440044003200420045003300440032004400370036007d000a05b5a49bc70524a59d0144ce9601668bdfb595edb7cf967600ca1e300600ca500000267b00360034003200420045004500380043002d0043003500370043002d0034003300410039002d0039003500360042002d003000360043003400330034003900370035003800390045007d000a058cd**10624fc8a0344a987016695d799a0cce6a5ac9e0100ca1e300a00ca500000267b00380042003100430033003300460037002d0035004400320042002d0034003900380031002d0039003800430032002d003000350043003300390036004500420042003000350033007d000a05f7e7f0d80824abba01448193016698859798ecf2bad85300d20a024f6dc889ca1e300600ca500000267b00390033003500430030004100360043002d0031004600410042002d0034003800390038002d0042004500410037002d004300350033003800420035003900300046003900330044007d000a05ec94f09a0924ab3f4498910166becf96c6d396e4fc3d00d20a021b52fa5eca1e00cc3d1205267b00340042004200390037003500320031002d0033004300410035002d0034004600310032002d0041004600430030002d003300440041003500340046004200340035004500380046007d00267b00380041004200460030004100350046002d0035004200430045002d0034003100460030002d0042004200320038002d003900460030003500390039003700450030003600310038007d00267b00380042003300450037004100410038002d0037003600420039002d0034003500450033002d0038004400420032002d004500440035003800460035004500370045004400460039007d00267b00440035004200360039003100380043002d0030003700320035002d0034003200410044002d0041004400300038002d003500460039003200310044003400450036004300320035007d00267b00460043004600420045003100370036002d0037004600460030002d0034004400380045002d0041003300360043002d004600370042004100360041003500410032003200330035007d00ca50000000
- taskkill /f /im explorer.exe&start explorer.exe
复制代码
作者: WHY 时间: 2020-7-2 22:37
回复 6# smss
你应该试一试 2# 的 PowerShell 脚本,我测试是没有问题的。这个问题不要在 bat 上浪费时间。
作者: WHY 时间: 2020-7-2 22:39
本帖最后由 WHY 于 2020-7-4 21:35 编辑
- Rem 将Binary类型的注册表数据写入到指定的注册表,注册表项通过搜索关键字得到。
- const Data = "0200000036E79387633AD60100000000434201000A0A00D0" '一长串Binary类型的注册表数据
- const HKCU = &H80000001
-
- Dim regPath, keyWord, objWMI
- regPath = "HKCU\Software\Microsoft\Windows\CurrentVersion"
- keyWord = "$start.tilegrid$windows.data.curatedtilecollection.tilecollection"
- Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\Root\Default:StdRegProv")
-
- Function GetRegistryKey(regPath, keyWord)
- Dim ws, objExec, strLine
- Set ws = CreateObject("WScript.Shell")
- Set objExec = ws.Exec( "reg query " & chr(34) & regPath & chr(34) & " /s /k /f " & chr(34) & keyWord & chr(34) )
- while objExec.status < 1
- WScript.Sleep 200
- wend
- GetRegistryKey = ""
- Do while Not objExec.StdOut.AtEndOfStream
- strLine = objExec.StdOut.ReadLine
- If UCase(Left(strLine, 17)) = "HKEY_CURRENT_USER" Then
- GetRegistryKey = Mid(strLine, 19)
- Exit Do
- End If
- Loop
- End Function
-
- Function SetRegistryValue(regSubPath, ByRef arrData)
- Dim arrName
- objWMI.EnumKey HKCU, regSubPath, arrName '遍历子项,参数:根, 子项路径, 子项名数组
- If Not IsArray(arrName) Then 'regSubPath不包含子项
- objWMI.CreateKey HKCU, regSubPath + "\Current" '创建子项,参数:根, 子项路径
- ElseIf Not Contains(arrName, "Current") Then 'regSubPath包含子项,但不包含Current子项
- objWMI.CreateKey HKCU, regSubPath + "\Current" '创建子项
- End If
- objWMI.SetBinaryValue HKCU, regSubPath + "\Current", "Data", arrData '写入注册表,参数:根,子项路径,值名,要写入的数据
- End Function
-
- Function Contains(arr, item)
- Dim i
- For i = 0 To UBound(arr)
- If LCase(arr(i)) = LCase(item) Then
- Contains = True : Exit Function
- End If
- Next
- Contains = False
- End Function
-
- Function ConvertData(Data)
- Dim i, count, s, arrData
- count = Len(Data) \ 2
- ReDim arrData(count - 1)
- For i = 1 To Len(Data) Step 2
- s = "&H" & Mid(Data, i, 2)
- arrData(i\2) = 1 * s
- Next
- ConvertData = arrData
- End Function
-
- Dim regSearchPath
- regSearchPath = GetRegistryKey(regPath, keyWord) '搜索包含关键字的注册表项路径
-
- If regSearchPath = "" Then
- MsgBox "No Such Registry Key Found"
- Else
- Call SetRegistryValue( regSearchPath, ConvertData(Data) )
- MsgBox "Done"
- End If
复制代码
改一点点小错误,顺便加一点注释
作者: smss 时间: 2020-7-2 23:21
回复 7# WHY
作者: WHY 时间: 2020-7-3 00:21
回复 9# smss
Binary 类型注册表数据应该是由 0-9 a-f 组成,不能包含 * 字符。
6#数据就包含 * 字符,我原本以为你特意加上*字符是避免误操作的。
作者: smss 时间: 2020-7-3 00:32
回复 10# WHY
好的
作者: LJY4.0 时间: 2022-6-12 10:02
回复 11# smss
作者: dhwc 时间: 2022-9-29 16:50
回复 1# smss
win11测试不成功,我在本机直接导入导出HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount这个位置的注册表没用啊?
恳请指导
作者: 微笑隐薄凉 时间: 2024-10-26 13:15
回复 2# WHY
批处理是可以用^+回车转行的,支持导入超长的内容。
作者: WHY 时间: 2024-10-27 22:49
回复 14# 微笑隐薄凉
这样一长串的数据,如何用bat脚本添加多个^和回车换行,本身就是个问题。
不要告诉我,用手工添加。
作者: ygqiang 时间: 2024-10-31 18:17
回复 15# WHY
只能手工添加了吧?
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |