I want to alias python3 to python on Windows.

You haven't mentioned what release of Python you are using (e.g. "vanilla" Python, Anaconda, SciPy, etc.), but if I am not misunderstanding, this likely shouldn't be necessary. For Windows versions of Python (i.e. not WSL), python3 is not typically a standard alias. That is, the Python 3.x executable is usually just python (python.exe).

Be aware that python.exe should be in a folder listed in your Windows Path if you want to access it as just python. You can find a refresher on editing Windows Path variables here.

If you meant the reverse (i.e. you want to run Python 3.x with python3), then there are at least a few possible approaches (each item below is a separate option):

  1. Make symbolic link called python3.exe to your preferred copy of Python 3.x with mklink:

    mklink "C:\path\to\symlink\python3.exe" "C:\path\to\Python3\python.exe"
    
  2. Copy the python.exe file in your preferred installation of Python 3.x and rename the copied executable python3.exe.

  3. If you aren't set on specifically using python3 and have the Python Launcher for Windows (py.exe) installed which comes with "vanilla" Python from python.org, you can use:

    # Use the "default" installation of Python 3.x, 
    # as detected by the Python Launcher for Windows.
    
    py 3
    

or:

   # Use a specific version of Python 3.x if you have more
   # than one version installed, outside of a virtual environment.

   py 3.8
  1. Create a Windows batch file called python3.bat with the following information:

ex. python3.bat

    C:\path\to\Python3\python.exe %*
  1. You can also alias Python Launcher for Windows (py.exe) calls in a similar manner in python3.bat e.g.:

ex. python3.bat

    py 3 %*

or:

ex. python3.bat

    py 3.8 %*

With all the options above, any "python3" file you wish to access from the command line (i.e. any symbolic link, a renamed executable copy, py.exe or python3.bat) must be in a folder located in your Windows Path.

Notes

  • These options obviously do not include any option to "alias" python.exe at the command line (e.g. via doskey macros, as mentioned in the comments, or possibly via actual alias commands specific to a given terminal). It also ignores the possibility that some distributions of Python could (theoretically) already come with a python3 alias.

  • Creating a symbolic link with mklink on Windows may require administrative privileges on versions of Windows earlier than some early releases of Windows 10.

  • When creating a symbolic link, be certain to include the file extension (.exe). This is not optional if you want the link to work correctly.

  • It is likely best to leave any renamed executable copy (option 2) in the same folder as the original python.exe.


If you are still wondering how to do it, Here is one workaround!
Create a PowerShell file named python3.ps1 and inside that just type python and save it anywhere you like.
Copy that path and add that path to the Environment path. Now you are ready to go!
Just type python3 and it runs python.
you can also use the python command to use python.


If you are using the Windows PowerShell and not the command prompt, you can use the following code:

Set-Alias -Name python3 -Value python

or use the following code:

Set-Alias -Name python3 -Value "C:\Python39\python.exe"

Note that this is a temporary Alias for the current session, to make it permanent; you have to copy the above command into an empty text file and name it Profile.ps1 file and copy it to one of the following folders:

if you are using PowerShell 7:

{My Documents Folder}/PowerShell

if you are using Windows PowerShell which comes by default in Windows 10:

{My Documents Folder}/WindowsPowerShell

or inside the installation folder of PowerShell, which can be figured out by:

cd $PSHOME\