CMD opens Windows Store when I type 'python'
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
When you type python in Windows CMD and it opens the Microsoft Store instead of running Python, it means Windows is executing an "app execution alias" — a stub that redirects to the Store to install Python. This happens because Windows 10/11 ships with placeholder python.exe and python3.exe aliases that take priority over your actual Python installation in the PATH. The fix is to disable these aliases in Windows Settings or ensure your Python installation's directory appears before the alias directory in PATH.
Why This Happens
Windows 10 (version 1903+) and Windows 11 include app execution aliases for python.exe and python3.exe in %LOCALAPPDATA%\Microsoft\WindowsApps. These are zero-byte stub executables that redirect to the Microsoft Store when run:
If WindowsApps appears before your Python directory in PATH, the stub runs first.
Fix 1: Disable App Execution Aliases (Recommended)
- Open Settings (Win + I)
- Go to Apps → Advanced app settings → App execution aliases
- On older Windows 10: Apps → Apps & features → App execution aliases
- Turn OFF both python.exe and python3.exe aliases
After disabling, CMD uses the real python.exe from your PATH.
Fix 2: Reorder PATH
Ensure your Python directory appears before WindowsApps in PATH:
To fix:
- Open System Properties → Environment Variables
- Under User variables or System variables, select Path and click Edit
- Move your Python directory (
C:\Python311\andC:\Python311\Scripts\) above%LOCALAPPDATA%\Microsoft\WindowsApps - Click OK and restart CMD
Or from the command line:
Fix 3: Use the Python Installer's PATH Option
When installing Python from python.org:
- Run the Python installer
- Check "Add Python to PATH" on the first screen
- Click Customize installation → check "Add Python to environment variables"
- The installer places your Python directory before
WindowsAppsin PATH
If you already installed without this option:
Fix 4: Use the Full Path
As a workaround, call Python using its full path:
The py launcher (py.exe) is installed in C:\Windows\ and is not affected by the app execution alias issue.
Verifying the Fix
PowerShell Differences
PowerShell has the same issue but also has its own alias system:
Common Pitfalls
- Disabling aliases but not restarting CMD: After changing app execution aliases or PATH, existing CMD windows still use the old PATH. Close all CMD windows and open a new one for changes to take effect.
- Using
setxand expecting immediate effect:setxmodifies the registry but does not update the current session's PATH. Aftersetx, open a new CMD window. Or usesetfor the current session andsetxfor persistence. - Virtual environment activation not finding Python: If the base Python is the Store stub, creating a virtual environment fails. Fix the PATH first, then create your virtualenv.
- Multiple Python versions with conflicting PATH entries: If both Python 3.9 and 3.11 are installed, their PATH entries may conflict. Use the
pylauncher (py -3.11,py -3.9) to select a specific version without PATH ordering issues. - Assuming the fix works for all terminals: Windows Terminal, Git Bash, WSL, and VS Code each have their own PATH handling. Disabling the alias fixes CMD and PowerShell, but other terminals may need separate configuration.
Summary
- Windows 10/11 ships stub
python.exealiases that redirect to the Microsoft Store - Disable them in Settings → Apps → App execution aliases
- Alternatively, reorder PATH so your Python directory comes before
WindowsApps - Use the
pylauncher (py.exe) to avoid PATH issues entirely - Always restart CMD after changing PATH or alias settings
- Check with
where pythonto verify which executable runs
Related reading
- Colab 0 UNIMPLEMENTED DNN library is not found
- Collatz Conjecture Python - Incorrect Output Above 2 Trillion Only
- Collections.defaultdict difference with normal dict
- Collections.defaultdict difference with normal dict
- CNAME entry not working on NameCheap using Amazon Certificate Manager
- CNN Pytorch Error Input type torch.cuda.ByteTensor and weight type torch.cuda.FloatTensor should be the same
- Combinations from dictionary with list values using Python
- Combine Date and Time columns using pandas
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.