bat安装python的msi包
#把python-2.7.3.amd64.msi和这个脚本放在同一个目录下
@ECHO OFF
::定于初始变量
SET python_home=C:\Python27
SET python_exe=%python_home%\python.exe
::判断python是否安装
if exist %python_exe% (
echo file %python_exe% is exist ......
) else (
::默认安装目录为C:\Python27
ECHO Start to install python-2.7.3.amd64 ......
msiexec /i python-2.7.3.amd64.msi /quiet /passive
ECHO install python2.76 successfully......
)
::检查path中有没有c:\python27(有就跳到run,没有就接着执行)
echo start to set python sys path.......
echo %path%|findstr /i "%python_home%"&&(goto run)
::添加到环境变量
echo check python path......
wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;%python_home%"
::再永久生效
echo aplly path......
set path=%path%;%python_home%
path
:run
::开始安装setuptools
::开始执行python
echo now run py........
python a.py
pause
exit
运维虐我千万遍,我对运维如初恋。