2017-02-18 95 views
-8

我需要把这段代码转换为VBScript如何将.Net代码转换为vbscript?

SetAttr("C:\Users\" + Environment.UserName + "\Desktop\Client.exe", FileAttribute.Hidden) 

任何人都可以让我在VBScript上面的代码?

+6

请看看[如何对提问](http://stackoverflow.com/help/how-to-ask) – swe

回答

0

您必须使用FileSystemObject。提示:这可能很容易搜索到。

例子:

Sub HideFolderFiles(filespec) 
    Dim fs, f, r 
    Set fs = CreateObject("Scripting.FileSystemObject") 
    Set f = fs.GetFolder(filespec).Files 
    f.attributes = 2 'hidden 
End Sub 

来源:https://www.experts-exchange.com/questions/28054761/VBScript-to-set-file-attributes.html

+0

请我需要完整的代码,我如何选择Environment.UserName路径 – polk

+0

感谢它的工作原理,但我只需要Environment.UserName目录 – polk

+0

非常感谢我的问题解决谢谢 – polk