We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.
%~dp0 is the variable you want.
It outputs the drive and path of the batch file.
EX1: C:\mydir\myfile.bat becomes C:\mydir\
Ex2:
@echo offSet SetupApp=WinaeroTweaker-0.17.0.0-setup.exe%SetupApp% /VERYSILENT /PORTABLE /DIR="%~dp0\wt_portable"exit
Will create a new directory in the directory where you have theWinaeroTweaker-0.17.0.0-setup.exefile calledwt_portableand run theWinaeroTweaker-0.17.0.0-setup.exeto create a portable extraction of all files.Here’s a MS reference, it works in thing other than Batch; like VBS SCCM, PS, shortcuts too.
https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true