How to get the path of the batch script in Windows?

前端 未结 8 1319

I know that %0 contains the full path of the batch script, e.g. c:\\path\\to\\my\\file\\abc.bat

I would path to be equal to

8条回答
  •  天命终不由人
    2020-12-04 05:21

    You can use following script to get the path without trailing "\"

    for %%i in ("%~dp0.") do SET "mypath=%%~fi"
    

提交回复
热议问题