How to Install Python3 on Windows using PowerShell

If you some reason you want to download and install Python 3.x.x using PowerShell, then you can write your own script as follows.

Script to download Python using PowerShell

# Step 1: get the download link of Python version 3.x.x from the internet
$pythonInstallerUrl = "https://www.python.org/ftp/python/3.9.8/python-3.9.8.exe"

# Step 2: set the PATH where the Python installer will be downloaded.
$pythonSetup = "D:\setup\python-3.9.8.exe"

# Step 3: Download the Pyhton 3.x.x setup file.
Invoke-WebRequest -Uri $pythonInstallerUrl -OutFile $pythonSetup

# Step 4: Install Python with default settings.
Start-Process -Wait -FilePath $pythonSetup -ArgumentList "/quiet", "PrependPath=1"

# Step 5: Remove the setup file (Optional)
Remove-Item -Path $pythonSetup
Steps to download and Install Python using PowerShell

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!