Board logo

标题: [问题求助] VBS能否删除开始----文档里抽历史记录? [打印本页]

作者: ww0000    时间: 2013-9-5 11:36     标题: VBS能否删除开始----文档里抽历史记录?

VBS能否删除开始----文档里抽历史记录?
C:\Documents and Settings\Administrator\Recent

Recent文件夹是隐藏的!
作者: batman    时间: 2013-9-5 15:53

  1. Dim objFSO, Path
  2. Set objFSO = CreateObject("Scripting.FileSystemObject")
  3. Path = "C:\Documents and Settings\Administrator\Recent"
  4. For Each File In objFSO.GetFolder(Path).Files
  5.   objFSO.DeleteFile File
  6. Next
  7. Set objFSO = Nothing
  8. WScript.Echo "OK"
复制代码

作者: ww0000    时间: 2013-9-5 16:55

回复 2# batman

谢谢,能删除!
但我将
C:\Documents and Settings\Administrator\Recent
换成
C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files

为什么不能删除上网历史记录呢?
作者: ww0000    时间: 2013-9-5 17:31

本帖最后由 ww0000 于 2013-9-6 08:14 编辑

这个网上找的,也不行
  1. On error resume Next
  2. Set WshShell = WScript.CreateObject("WScript.Shell")
  3. Set WshSysEnv = WshShell.Environment("Process")
  4. Set objFSO = CreateObject("Scripting.FileSystemObject")
  5. Const DeleteReadOnly = TRUE
  6.   objFSO.DeleteFile(WshSysEnv("userprofile") & "\Local Settings\Temporary Internet Files\*.*"), DeleteReadOnly
  7.   objFSO.DeleteFile(WshSysEnv("userprofile") & "\Local Settings\Temp\*.*"),DeleteReadOnly            
  8.    ShowSubFolders objFSO.GetFolder(WshSysEnv("userprofile") & "\Local Settings\Temporary Internet Files\")
  9.    ShowSubFolders objFSO.GetFolder(WshSysEnv("userprofile") & "\Local Settings\Temp\")                     
  10. Sub ShowSubFolders(Folder)
  11.   For Each Subfolder in Folder.SubFolders
  12.     objFSO.DeleteFile(Subfolder.Path & "\*.*"), DeleteReadOnly
  13.   ShowSubFolders Subfolder
  14.   Next
  15. End Sub
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2