@echo off
REM 判断文件类型
set "str=%~x1"
set PYTHON_EXE_PATH=@"C:\Python27\python.exe"
if "%str%"==".xlsx" (goto XLSX) else echo "File Format is Error!"
:XLSX
REM 如果拖入的文件后缀是xlsx
echo %~nx1
set Cur_File_Path=%cd%\..\..
cd %Cur_File_Path%
for /f "delims=" %%i in ('where python') do set PYTHON_EXE_PATH=%%i
%PYTHON_EXE_PATH% gen_code.py %~nx1
pause
exit
1)获取拖入到bat文件上的文件路径
2)获取python安装目录
3)执行python文件