Try putting this in the batch:
pushd "%~p0" 2> nul pushd "\\%~p0" 2> nul
If started from a UNC folder, the 1st line will fail, but the 2nd will work.
If started from a drive mapped folder, the 2nd line will fail, but the 1st will work.
Either way, the current folder will be where the batch file is sitting, and you can change folders from there.
Later, you can use cd
to show which folder you are working from.