WSCRIPT取得当前执行路径

test.bat

mode con lines=2000
cscript.exe /x E:\PersonalSet\Desktop\test.vbs
pause

test.vbs

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
StrCurPath = fso.GetFolder(".")
WScript.StdOut.WriteLine StrCurPath

-----------------------------------------------------------------------

结果是输出了test.bat所在路径

原文地址:https://www.cnblogs.com/dongzhiquan/p/1994598.html