मैं एक बटन दबाकर वर्तमान दिनांक और समय के साथ एक सिस्टम पुनर्स्थापना बिंदु बनाने के लिए एक रास्ता तलाश रहा हूँ। मैंने ऐसा करने के लिए एक सरल तरीके से वेब खोजने की कोशिश की है लेकिन मुझे अभी तक कोई नहीं मिला है।प्रोग्राम व्यवस्थित रूप से सिस्टम पुनर्स्थापना बिंदु कैसे बनाएं?
मुझे यह कोड स्निपेट मिला: http://msdn.microsoft.com/en-us/library/windows/desktop/aa378847%28v=vs.85%29.aspx लेकिन यह वीबी में है और सी # नहीं, मैंने इसे थोड़ा बदलने की कोशिश की लेकिन मुझे नहीं लगता कि मैं इसका अनुवाद करने का एक अच्छा काम कर रहा हूं।
Dim restPoint = GetObject("winmgmts:\\.\root\default:Systemrestore")
If restPoint IsNot Nothing Then
If restPoint.CreateRestorePoint("test restore point", 0, 100) = 0 Then
MsgBox("Restore Point created successfully")
Else
MsgBox("Could not create restore point!")
End If
End If
सी # करने के लिए "का अनुवाद" करने के लिए आसान होना चाहिए:
'CreateRestorePoint Method of the SystemRestore Class
'Creates a restore point. Specifies the beginning and
'the ending of a set of changes so that System Restore
'can create a restore point.This method is the
'scriptable equivalent of the SRSetRestorePoint function.
Set Args = wscript.Arguments
If Args.Count() > 0 Then
RpName = Args.item(0)
Else
RpName = "Vbscript"
End If
Set obj = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")
If (obj.CreateRestorePoint(RpName, 0, 100)) = 0 Then
wscript.Echo "Success"
Else
wscript.Echo "Failed"
End If
यह प्रश्न भी देखें: http://stackoverflow.com/questions/32845/creating-system-restore-points-thoughts – M4N