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