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