0

As explained in SO Post, I understand how to retrieve arguments entered by user over powershell. However, I am interested in getting whatever was exactly typed before arguments. For example, for the command entered by user: py myscript.py, I should print/retrieve py.

Similarly for user input python myscript.py, I should print/get python ?

nuki
  • 101
  • 5
  • 2
    I think you want `sys.executable` – JonSG May 17 '21 at 23:32
  • Tried that, it prints `/path/to/Python37-32/python.exe` or `/path/to/Python38-32/python.exe` when I use `python` and `py` in command line, respectively. But that still doesn't tell whether the user entered `python` or `py`? – nuki May 17 '21 at 23:43
  • You might check out: https://stackoverflow.com/questions/667540/full-command-line-as-it-was-typed Though it does not really look hopeful. – JonSG May 17 '21 at 23:55

0 Answers0