FSO get folder name
时间: 2024-03-09 09:49:27 浏览: 96
To get the name of a folder using FSO (File System Object) in VBScript, you can use the following code:
```
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("C:\Users\Username\Desktop\MyFolder")
folderName = folder.Name
MsgBox "The folder name is: " & folderName
```
This code creates a FileSystemObject, gets a reference to a specific folder using the GetFolder method, and then retrieves the folder name using the Name property. The resulting folder name is then displayed using a MsgBox.
阅读全文