2018.8.10 programming bat based on python

@echo off

REM Current DevProg Version. Match the pip package version (x.y.z)
SET currentversion=0.4.0

REM Installation paths. If copying this to a new product, you MUST edit the last parts of venvdir and shortcuts!
SET basedir=C:GDNVirtualEnvs  // installation file directory
SET logdir=%basedir%Logs   //debug information
SET venvdir=%basedir%wifiheater 
SET scriptdir=%venvdir%Scripts

SET shortcut=%userprofile%DesktopProgram WifiHeater.lnk
SET shortcuttargetdir=%scriptdir%program_wifiheater.exe


if not exist %basedir% (
mkdir %basedir%  // create file
)

if not exist %logdir% (
mkdir %logdir%
)

if not exist %venvdir% (
python -m venv %venvdir%
)

if not exist %scriptdir%activate.bat (
echo The virtual environment in %venvdir% appears to be invalid.
echo Delete the folder and run this script again.
exit /b 1
)

call %scriptdir%activate.bat
pip uninstall -y wifiheater esptool pyserial pyaes ecdsa six
pip install six-1.10.0-py2.py3-none-any.whl
pip install ecdsa-0.13-py2.py3-none-any.whl
pip install pyaes-1.6.1.tar.gz
pip install pyserial-3.4-py2.py3-none-any.whl
pip install esptool-2.3.1-py3-none-any.whl
pip install wifiheater-%currentversion%-py3-none-any.whl

powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%shortcut%');$s.TargetPath='%shortcuttargetdir%';$s.Arguments='program --baud 921600';$s.WorkingDirectory='%logdir%';$s.Save()"

 -----------

原文地址:https://www.cnblogs.com/huangbaobaoi/p/9456740.html