简体   繁体   English

如何使用WinAPI(而非WMI)枚举系统还原点?

[英]How to enumerate system restore points using WinAPI (not WMI)?

必须适用于WinXp-Vista-Windows 7

After having a short look at the available documentation it seems that there is no way around WMI if you want to list existing restore points. 在浏览了可用文档之后,如果要列出现有的还原点,似乎WMI周围没有办法。

The Windows API only offers you functions for setting and removing restore points: Windows API仅向您提供用于设置和删除还原点的功能:

MSDN also has samples how to use these methods. MSDN还提供如何使用这些方法的示例

For listing the existing restore points you can use the VBScript sample code from here (Note that the code needs elevation on Vista and above): 要列出现有的还原点,您可以从此处使用VBScript示例代码(请注意,该代码在Vista和更高版本上需要提升):

Set RPSet = GetObject("winmgmts:root/default").InstancesOf ("SystemRestore")
for each RP in RPSet
    wscript.Echo "Dir: RP" & RP.SequenceNumber & ", Name: " & RP.Description & ", Type: ", RP.RestorePointType & ", Time: " & RP.CreationTime
next

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM