[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[问题求助] VBS能否删除开始----文档里抽历史记录?

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

Recent文件夹是隐藏的!

本帖最后由 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
复制代码

TOP

回复 2# batman

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

为什么不能删除上网历史记录呢?

TOP

  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"
复制代码
1

评分人数

***共同提高***

TOP

返回列表