<p><code>%dp0</code> will be the directory. <a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/call#batch-parameters">Here’s some documentation on all of the path modifiers</a>. Fun stuff <img src="https://forum-microsoft.fr/images/emoji/twitter/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>To remove the final backslash, vous pouvez utiliser the <code>:n,m</code> substring syntax, like so:</p>
<pre><code class="lang-auto">SET mypath=%dp0
echo %mypath:0,-1%
</code></pre>
<p>I don’t believe there’s a way to combine the <code>%0</code> syntax with the <code>:n,m</code> syntax, unfortunately.</p>