Computer Hope

Microsoft => Microsoft DOS => Topic started by: Johnfairweather on January 23, 2016, 11:23:02 AM

Title: A problem with Environment Variables
Post by: Johnfairweather on January 23, 2016, 11:23:02 AM
In my Environment Variable (on my Windows 8.1, x64 PC), I have set up -

1) A variable of "Python27", with a value of "c:\python27".
2) A variable of "Python35", with a value of "C:\users\john fairweather\appdata\local\programs\python\python35-32"

Where Python27 & Python35 are folders.

Opening up CMD (Version 6.3.9600), I would have expected that on entering "Python27" or "Python35", I would have got to these directories, but I am not, I am receiving the message "'Python27' is not recognised as an internal or external command, operable program or batch file."

Please advised what I have done wrong.
Title: Re: A problem with Environment Variables
Post by: BC_Programmer on January 23, 2016, 11:37:41 AM
Environment Variables are referenced by enclosing them in percent signs. so %Python27% for example. The contents of the variable can be considered to replace the location you have them in your command. So, for example, if you used %Python27% as is, it would be the same as just typing C:\python27 which would give the same error. You would need to use them in conjunction with an appropriate command. In this case, CD (Change Directory), such as
Code: [Select]
cd %Python27%
Title: Re: A problem with Environment Variables
Post by: Johnfairweather on January 23, 2016, 12:56:26 PM
Thanks, that was the answer I wanted.
Title: Re: A problem with Environment Variables
Post by: Geek-9pm on January 23, 2016, 01:58:54 PM
You can make a sort of 'alias' in windows to open a directory.
You have  a folder with some horrible long path name.
You make a shortcut by sending it to the desktop as a shortcut.
Rename it to something clever and short.
Move it to the C:\windows directory.
Now you can run it and it will open the directory for you.

Just trying to help.  :)