The variable %0 in a batch script is set to the name of the executing batch file.
The ~dp special syntax between the % and the 0 basically says to expand the variable %0 to show the drive letter and path, which gives you the current directory containing the batch file!