Contents

How to automate Python 3.12 install on Windows 11

0

This Python Howto article will guide you step-by-step to create a batch script that will automate the installation of Python 3.12 on Windows 11. This guide will also work for installing other version of Python on both Windows 10 as well as Windows 11.

autoinstall-python.bat batch script

@echo off
cd %USERPROFILE%\Desktop

:: Python 3.10
:: set https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe

:: Python 3.11
:: set PYTHON_URL=https://www.python.org/ftp/python/3.11.4/python-3.11.4-amd64.exe

:: Python 3.12 
set PYTHON_URL=https://www.python.org/ftp/python/3.12.0/python-3.12.0b4-amd64.exe

powershell -Command "& { iwr '%PYTHON_URL%' -OutFile %USERPROFILE%\Desktop\python-installer.exe }"

python-installer.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0

if ERRORLEVEL 1 (
    echo Python installation failed!
    exit /b %ERRORLEVEL%
) else (
    echo Python installation succeeded!
)
pause

Download autoinstall-python.bat


You can also install a specific version of Python by uncommenting the respective url line in the script. At the time of writing, Python 3.12 is still in beta so you may prefer to install Python 3.11. Always reference https://www.python.org/downloads/ for the url to the latest version of the python installer.

Execute the batch script

  1. Download and save autoinstall-python.bat onto your Desktop Right click on autoinstall-python.bat
  2. Click Run as administrator ![[right-clock-run-administrator.webp]]

What the script does

The script will download the specified python installer from python.org and save it to the user’s desktop folder as python-installer.exe.

Next, the script will execute python-installer.exe with command line switches for “Install for all users” and silent install

Once the script is done executing, we can open command prompt and test that python is properly installed.

Microsoft Windows [Version 10.0.22621.1702]
(c) Microsoft Corporation. All rights reserved.

C:\Users\jc> where python
C:\Program Files\Python312\python.exe
C:\Users\jc\AppData\Local\Microsoft\WindowsApps\python.exe

C:\Users\jc> python -V
Python 3.12.0b4

C:\Users\jc> python
Python 3.12.0b4 (tags/v3.12.0b4:97a6a41, Jul 11 2023, 13:49:15) [MSC v.1935 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
Use exit() or Ctrl-Z plus Return to exit
>>> quit()

C:\Users\jc>

As you can see in the output of where python, python was installed into C:\Program Files\Python312.

Conclusion

Automating the installation of python can save time and make you more efficient when setting up a new development environment. I hope you found this python tutorial helpful, checkout our other python guides and howto articles on pythonfix.com

Instructions Video

Similar Queries

  • Python 3.12 Silent Install
  • How to silently install Python 3.12
  • scripted install of Python 3.12
  • Python 3.12 Installer Switches
  • Install Python 3.12 without prompts
  • Automate Python Installer
  • Install Python 3.12 on Windows 11

Related Packages & Articles

botright 0.5.1

Botright, the most advance undetected, fingerprint-changing, captcha-solving, open-source automation framework. Build on Playwright, its as easy to use as it is to extend your code. Solving your Captchas for free with AI.

pywinauto 0.6.8

A set of Python modules to automate the Microsoft Windows GUI

pywhatkit 5.4

PyWhatKit is a Python library with various helpful features. It's easy-to-use and does not require you to do any additional setup. Currently, it is one of the most popular library for WhatsApp and YouTube automation. New updates are released frequently with new features and bug fixes.

pygnmi 0.8.14

Pure Python gNMI client to manage network functions and collect telemetry.

pyppeteer 2.0.0

Headless chrome/chromium automation library (unofficial port of puppeteer)