替换 VBScript 中的 %~dp0

Jor*_*rdy 5 vbscript batch-file

我在 VBScript 中找不到任何内容来替换 %~dp0

On error resume next
Set shell= createobject("WSCRIPT.SHELL")
Shell.run "%~dp0test.bat", vbhide
Run Code Online (Sandbox Code Playgroud)

And*_*y M 5

Set fso = CreateObject("Scripting.FileSystemObject")
GetTheParent = fso.GetParentFolderName(Wscript.ScriptFullName)
Run Code Online (Sandbox Code Playgroud)

摘自这里:

要在脚本中使用获得的值,请在需要其值的位置添加对变量的引用。例如:

Shell.run GetTheParent & "\test.bat", vbhide
Run Code Online (Sandbox Code Playgroud)