Comment get the path of the script batch dans Windows?

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


Source : Stack Overflow [windows].)

%~dp0 will be the directory. Here’s some documentation on all of the path modifiers. Fun stuff :slight_smile:

To remove the final backslash, vous pouvez utiliser the :n,m substring syntax, like so:

SET mypath=%~dp0
echo %mypath:~0,-1%

I don’t believe there’s a way to combine the %0 syntax with the :~n,m syntax, unfortunately.