Sunday, August 30, 2015

windows 7 - how to properly set environment variables


I've recently started using Windows (having used Ubuntu up until now) and I find myself unable to properly set environment variables. Whenever I set them they don't seem to work. I've been going to Start->Edit Environment Variables for your Account and editing the PATH value in the upper half of the GUI. Here's what I've got so far.


 ;C:\Chocolatey\bin;C:\tools\mysql\current\bin;C:\Program Files (x86)\Git\bin;C:\Program Files\MySQL\MySQL Server 5.6\bin\;C:\Python33\Scripts;

These are each the parent directories of the executables I'd like to be able to run by name from CMD, but mysql, git, and pip aren't being recognized. Am I doing something wrong syntactically or at a general understanding level? I'd like to be able to run these commands without having to specify the full path to the executables every time.


EDIT: The full PATH extracted from CMD


PATH=C:\Python33\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\GTK2-Runtime\bin;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Java\jre7\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.3.4\; ;C:\Chocolatey\bin;C:\tools\mysql\current\bin

I'm being forced to use Windows by my work environment, I don't enjoy the state of affairs.


Answer



Here are some amendments i'd make. So try this command


set PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Python33;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\GTK2-Runtime\bin;C:\Program Files\WIDCOMM\Bluetooth Software;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\QuickTime\QTSystem;C:\Program Files (x86)\Common Files\Acronis\SnapAPI;C:\Program Files (x86)\Java\jre7\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files (x86)\Microsoft SDKs\TypeScript;C:\Program Files (x86)\MySQL\MySQL Utilities 1.3.4;C:\Chocolatey\bin;C:\tools\mysql\current\bin

I edited the path in notepad


PATH=C:\Python33\; <-- may not be wrong but i'd remove the \ so C:\Python33;


and these three should really be at the beginning
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;


C:\Windows\System32\WindowsPowerShell\v1.0\; (may not be wrong but i'd remove the \ )


C:\Program Files\WIDCOMM\Bluetooth Software\; ditto


;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\; ditto


C:\Program Files\Microsoft SQL Server\110\Tools\Binn\; <-- Binn, hmm, turns out that's right Binn. Though i'd still change \; to ;


C:\Program Files (x86)\QuickTime\QTSystem\; <-- the \


C:\Program Files (x86)\Common Files\Acronis\SnapAPI\; <-- the \


C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\; <-- the \
C:\Program Files (x86)\Microsoft SDKs\TypeScript\; <--- the \


C:\Program Files (x86)\MySQL\MySQL Utilities 1.3.4\;; <--- two semi-colons!!! that should be one semi-colon


So, try that set path=........ command I mention. If it works then you can make it permanent in the GUI. I'd do it for the system path variable and remove the user path variable. (I think the user one appends to the system one, it's unnecessaru unless you want multiple users each with their own slightly different path)


And if it fails.. then you can remove chunks and see if it works, thus troubleshooting it.


added-
If the system path is greyed out, try making the user path blank, (put it in a text file first as a backup). Then click OK, open a cmd prompt window, and now you should try appending a directory to the path within the cmd prompt and see if it works.. So,
SET PATH=%PATH%;C:\Program Files (x86)\Git\bin


now type PATH see that the above command did append Git to the Path. And see if Git runs. That tells you that the PATH as it was, has no error in it. That means the System path is OK.. (as the user path was blank so the path there is just the system path). Try not to write any directories in the user path that duplicate what is in the system path, though probably no harm if you do. Then, look at that long set PATH= that I wrote which was an amendment of yours, and execute it at the cmd prompt and see if it works. If it does, then put it in the GUI. If it doesn't then troubleshoot why, by halving it, removing Git, appending Git, see if Git runs. See, if the final directory listed in the Path is searched, then the whole Path is fine. Hopefully that method will enable you to troubleshoot it and fix the Path.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...