System read-only variable %CD% keeps the path of the caller of the batch, not the batch file location.
You can get the pathname of the batch script itself with %0, parameter extensions can be applied to this so %~dp0 will return the Drive and Path to the batch script e.g. W:\scripts\ and %~f0 will return the full pathname W:\scripts\mybatch.cmd.
You can refer to other files in the same folder as the batch script by using this syntax:
This can even be used in a subroutine, Echo %0 will give the call label but, echo "%~nx0" will give you the filename of the batch script.
When the %0 variable is expanded, the result is enclosed in quotation marks.