vbs判断是否是控制台和取当前目录路径
版权声明:
本文为博主原创文章,转载请声明原文链接...谢谢。o_0。
更新时间:
2017-10-06 16:43:17
温馨提示:
学无止境,技术类文章有它的时效性,请留意文章更新时间,如发现内容有误请留言指出,防止别人"踩坑",我会及时更新文章
Function CurrentPath()
strPath = Wscript.ScriptFullName
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPath)
CurrentPath = objFSO.GetParentFolderName(objFile)
End Function
Function isConsole()
Set objArgs = Wscript.Arguments
'WScript.Echo objArgs.Count
'WScript.Echo objArgs(0)
isConsole = 0
If objArgs.Count > 0 Then
if objArgs(0) = "console" Then
isConsole = 1
End If
End If
End Function下面是一个使用vbs执行命令行程序的方法
Set oShell = CreateObject ("Wscript.Shell")
oShell.Run strArgs, false, falseoshell.run有三个参数第一个是命令行字符串,第二个是窗口样式false为不显示窗口,第三个是是否等这一行脚本执行完毕再向下执行