Create a custom command to run a program

In my case i want to type 'py' and run python.

Solution with Registry and doskey

so the solution comes to 2 steps

FIRST

find out where your program is 

where python

in my case returns "C:\Users\dcnhe\AppData\Local\Microsoft\WindowsApps\python.exe"

SECOND

go to the registry.

Navigate to 

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

Add a string

autorun

And set the doskey command

doskey py="C:\Users\dcnhe\AppData\Local\Microsoft\WindowsApps\python.exe"

 

Solution with Batch file and doskey

Win + R

shell:startup

Add new .bat file like startup.bat

and inside type

@echo off
doskey py="C:\Users\dcnhe\AppData\Local\Microsoft\WindowsApps\python.exe"