.bat file path to script code example
Example 1: get the default path batch
SET mypath=%~dp0
echo %mypath:~0,-1%
Example 2: batch file path
@echo off
setlocal
set file=C:\Users\l72rugschiri\Desktop\fs.cfg
for %%i IN ("%file%") DO (
echo filedrive=%%~di
echo filepath=%%~pi
echo filename=%%~ni
echo fileextension=%%~xi
)