Running vbscript from batch file

后端 未结 5 550
迷失自我
迷失自我 2021-01-31 18:26

I just need to write a simple batch file just to run a vbscript. Both the vbscript and the batch file are in the same folder and is in the SysWOW64 directory as the vbscript can

5条回答
  •  粉色の甜心
    2021-01-31 18:51

    You can use %~dp0 to get the path of the currently running batch file.

    Edited to change directory to the VBS location before running

    If you want the VBS to synchronously run in the same window, then

    @echo off
    pushd %~dp0
    cscript necdaily.vbs
    

    If you want the VBS to synchronously run in a new window, then

    @echo off
    pushd %~dp0
    start /wait "" cmd /c cscript necdaily.vbs
    

    If you want the VBS to asynchronously run in the same window, then

    @echo off
    pushd %~dp0
    start /b "" cscript necdaily.vbs
    

    If you want the VBS to asynchronously run in a new window, then

    @echo off
    pushd %~dp0
    start "" cmd /c cscript necdaily.vbs
    

提交回复
热议问题