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所在路径

你可能感兴趣的:(script)