Home  >  Article  >  Web Front-end  >  VBS code to get the names of all folders in the current directory

VBS code to get the names of all folders in the current directory

高洛峰
高洛峰Original
2017-01-16 10:11:051704browse

VBS gets the names of all folders in the current directory, excluding subfolders. I want to operate each folder, so it is best to use loop output.

When testing, make sure there is a folder in the current directory, otherwise the output will be empty.

Set ws=WScript.CreateObject("wscript.shell")
w=ws.CurrentDirectory
Set fso=WScript.CreateObject("scripting.filesystemobject")
Set fs=fso.GetFolder(w)
Set f=fs.SubFolders
For Each uu In f
t=t & uu.Path & vbcrlf
Next
MsgBox t

For more VBS code related articles to obtain the names of all folders in the current directory, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn