2017-02-18 153 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