Bin folder for Windows 10

7,338

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
Share:
7,338

Related videos on Youtube

Samuel Ivarsson
Author by

Samuel Ivarsson

Updated on September 18, 2022

Comments

  • Samuel Ivarsson
    Samuel Ivarsson over 1 year

    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?

  • Samuel Ivarsson
    Samuel Ivarsson over 4 years
    The bat solution was what I was looking for, thank you!
  • Sam
    Sam over 4 years
    Awesome, cheers!
  • Señor CMasMas
    Señor CMasMas over 4 years
    "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.
  • Sam
    Sam over 4 years
    @SeñorCMasMas Ah, good point. I never use that variable so I never think about it...