返回列表 发帖

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

blog:http://x0day.sinaapp.com
Dim fso,folderpath
Set fso = CreateObject("scripting.filesystemobject")
folderpath = "d:\1" '根据自己的需要自行修改
tp = "txt"      '指定文件的类型
hiddenFile(folderPath)
Sub hiddenFile(folderPath)
Set folders = fso.GetFolder(folderPath)
Set subfolders = folders.SubFolders
Set files = folders.Files
For Each file In files
If fso.GetExtensionName(file.Path)=tp Then
   file.Attributes = 2
End If
For Each folder In subfolders
hiddenFile(folder.Path)
nextCOPY
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

返回列表