set test_path=G:\aaa\bbb\ccc.xxxtest
for /f "delims=" %%a in ("%test_path%") do set file=%%~dpnxafile
d —— 磁盘im
p —— 路径文件
n —— 文件名磁盘
x —— 后缀名(带点)path