Home > Web Front-end > JS Tutorial > vbs code to get the current path

vbs code to get the current path

高洛峰
Release: 2017-01-16 10:28:41
Original
1713 people have browsed it

CMD当前路径

test = createobject("Scripting.FileSystemObject").GetFolder(".").Path
Wscript.echo test
Copy after login

当前VBS路径

test = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
Wscript.echo test
Copy after login
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 
Set colItems = objWMIService.ExecQuery("Select * From Win32_Process Where Name = 'wscript.exe' OR Name = 'cscript.exe'")
For Each objItem in colItems
lmq=lmq & objItem.CommandLine & vbcrlf
Next
Wscript.Echo lmq
Copy after login

如何获得当前.vbs文件运行的目录
比方说c:\a\a.vbs,如何或得它的目录c:\a,如果把它放在d:\b\b\目录下,获得它的目录为d:\b\b呢?

function getfolder() 
getfolder=left(wscript.scriptfullname,instrrev(wscript.scriptfullname,"\")-1) 
end function 
MsgBox getfolder()
Copy after login

更多vbs获取当前路径的代码相关文章请关注PHP中文网!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template