这是我现在的代码。这经历了探险家。但我需要一个更好的选择。
o = win32com.client.Dispatch("WScript.Shell")
#o.SendKeys("#m")
#time.sleep(5)
import subprocess as sp
p = sp.Popen(args='c:\\windows\\explorer.exe')
#o.AppActivate("Recycle Bin")
time.sleep(5)
o.SendKeys("^z", 0)
o.SendKeys("{ENTER}", 0)
# wait for undo to finish
time.sleep(10)
o.SendKeys("%{F4}", 0)
self.Pass('Undo deletion of %s to recycle bin')
#
self.Log("Finished")