I'm trying to replicate a UNIX bin folder on my Windows 10 PC. I have created a folder located at "C:\bin" and added it to my PATH variable. However, I'm not really sure as how to implement it any further than this. I've tried adding shortcuts (lnk-files) to the folder but I can't get that to work.

My goal is to be able to write "python37" in the command prompt to run "C:\Users\Samuel\AppData\Local\Programs\Python\Python37\python.exe" and write "python38" to run "C:\Users\Samuel\AppData\Local\Programs\Python\Python38-32\python.exe".

Simply adding both directories to the PATH variable wouldn't work since both of the executables have the same name, or am I wrong?


You should be able to create shortcuts and run them like in your original attempt. What's not working? But yes, you would have to name the shortcuts something unique in your bin folder. You would need to include the .lnk extension when executing.

So, in your C:\bin folder and with it in your path create a shortcut to the Python32 exe, name it python37 and execute it by:

C:\somedir> python37.lnk

Alternatively, you could create a .bat file and run it. For Python37 you could create C:\bin\python37.bat with this as the contents:

"C:\Users\Samuel\AppData\Local\Programs\Python\Python37\python.exe" %*

That should let you exclude the extension if you just want a clean python37 command.

C:\somedir> python37
| improve this answer | |
  • The bat solution was what I was looking for, thank you! – Samuel Ivarsson Jan 17 at 17:21
  • Awesome, cheers! – squillman Jan 17 at 17:24
  • "You would need to include the .lnk extension when executing.".. you can edit your environment to not require this. Simply add .LNK to your PATHEXT variable. – Señor CMasMas Jan 17 at 18:43
  • @SeñorCMasMas Ah, good point. I never use that variable so I never think about it... – squillman Jan 17 at 19:11

You can simply have both folders in the path and make a copy of your Python37 and 38 with those names. It wouldn't hurt anything to have it executed from python37.exe instead of python.exe.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.