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

前端 未结 8 1318

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:15

    %~dp0 - return the path from where script executed

    But, important to know also below one:

    %CD% - return the current path in runtime, for example if you get into other folders using "cd folder1", and then "cd folder2", it will return the full path until folder2 and not the original path where script located

提交回复
热议问题