Bin folder for Windows 10

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?

0

2 Answers

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
4

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like