首页 > 其他 > 详细

删除 ComponentFamilies 下的子键和 f256! 值

时间:2015-06-17 21:33:26      阅读:240      评论:0      收藏:0      [点我收藏+]

删除 ComponentFamilies 下的子键和 f256! 值


open Microsoft.Win32

let keys = [["wow64_microsoft-windows-runtime-metadata_31bf3856ad364e35_none_f5f8fe0dc9d4b745"; "6.3.9600.16384"];
            ["wow64_microsoft-windows-runtime-windows-media_31bf3856ad364e35_none_115654dfd0345658"; "6.3.9600.16384"]
        ]

let GetComponentFamilies key =
    let cfb = @"components-2\DerivedData\VersionedIndex\10.0.10074.0 (fbl_impressive.150424-1350)\ComponentFamilies"

    let t = Registry.LocalMachine.OpenSubKey( cfb, true)
    //t.GetSubKeyNames()

    [ for i in keys ->
       [i.[0]; "v!" + i.[1]]
    ]
    |> Seq.map ( fun i -> [(cfb + "\\" + i.[0]); i.[1]] )
    |> Seq.iter ( fun i ->  let t = Registry.LocalMachine.OpenSubKey(i.[0],true)
                            t.DeleteSubKeyTree(i.[1], false)
                            printfn "%s" "Delete f256!XXXXX"
                            t.GetValueNames()
                            |> Seq.filter ( fun i -> i.StartsWith("f256!"))
                            |> Seq.iter (fun i -> t.DeleteValue(i, false))
             )

GetComponentFamilies keys

感觉操作注册表,F# 要比 PowerShell 快很多。

删除 ComponentFamilies 下的子键和 f256! 值

原文:http://blog.csdn.net/hadstj/article/details/46537793

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!