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

[原创] VBScript脚本如何批量隐藏文件?

blog:http://x0day.sinaapp.com
  1. Dim fso,folderpath
  2. Set fso = CreateObject("scripting.filesystemobject")
  3. folderpath = "d:\1" '根据自己的需要自行修改
  4. tp = "txt"      '指定文件的类型
  5. hiddenFile(folderPath)
  6. Sub hiddenFile(folderPath)
  7. Set folders = fso.GetFolder(folderPath)
  8. Set subfolders = folders.SubFolders
  9. Set files = folders.Files
  10. For Each file In files
  11. If fso.GetExtensionName(file.Path)=tp Then
  12.    file.Attributes = 2
  13. End If
  14. For Each folder In subfolders
  15. hiddenFile(folder.Path)
  16. next
复制代码
1

评分人数

你的代码写完了吗?
这个东西的确没价值,你直接把属性设为2,原有的其他属性都不管了?
最好用或运算赋值。

TOP

回复 2# powerbat


    f.attributes = f.attributes +2
    要这样写吗?
x0day.sinaapp.com

TOP

f.attributes = f.attributes or 2

TOP

求详细的解释
x0day.sinaapp.com

TOP

返回列表