码迷,mamicode.com
首页 > 其他好文 > 详细

删除 ComponentFamilies 下的子键和 f256! 值

时间:2015-06-17 21:35:53      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:f#   注册表   

删除 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! 值

标签:f#   注册表   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!