[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python 3.6 on Windows - does a python3 alias get created by installation?

On 10/11/19, Gisle Vanem <gisle.vanem at> wrote:
> An "alias" could also simply be created using:
>    doskey python3=f:\ProgramFiles\Python36\python.exe

That's a console alias [1], which gets evaluated by the console host
process (conhost.exe) when the target process does a normal read via
ReadConsoleW or ReadFile. By default doskey.exe creates an alias for
"cmd.exe" processes. In the above case, if you enter a line in CMD's
prompt that starts with "python3" (ignoring initial whitespace), CMD
will instead read "f:\ProgramFiles\Python36\python.exe" from the
console input buffer.

There are obvious limitations. Since it matches at the start of a line
of input, we can't pipe to an alias; or run it on the right-hand side
of the &, &&, or || operators; or use it as a command in a `FOR /f`
loop; or control how it executes via the START command. Also, since
it's only implemented for reads from the current console, it can't be
used as a command in a batch script, i.e. CMD will read "python3" from
the batch file, not "f:\ProgramFiles\Python36\python.exe".