Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override System Environment variable path in windows (not admin access)

Issue is very peculiar, I have a version of NodeJS installed in Windows (in program files x86) and a newer version of software downloaded and exe is extracted.

The installed NodeJS (node.exe) 's path is included in system path variable. I added the extracted path to user environment path variable. After doing my bit of RTFM I came to know that in case path variable both system and user environment variables are combined and the system gets the precedence.

Is there any way I can override (or nullify) the system variable's PATH with user variable's path ? or can the precedence of reading variables be changed ?

like image 846
sij Avatar asked Mar 14 '17 13:03

sij


People also ask

How do I change System Variables without admin rights?

For accounts without admin privileges: Open "User Accounts" and choose "Change my environment variables" (http://support.microsoft.com/kb/931715). This dialog will show you your current user variables as well as the system variables. You may need to add a local PATH variable if you haven't already.

How do I set variables in Windows 10 without admin rights?

Control Panel -> User Accounts -> User Accounts -> Change my environment variables (left side). This will open the user variables without admin access allowing the user's variables to be edited. Make sure the user account's name is showing where the red circle is. Save this answer.

Can user variables override System Variables?

A regular user environment variable overrides completely a system one with the same name if both exist, but only for the specific user it is specified for. However, the user path variables is treated differently. It is appended to the system path variable when evaluating, rather than completely replacing it.


2 Answers

In cmd, type

set PATH=D:\Path_To_Local_Folder;%PATH%
node

It will start node from your local folder.

like image 112
mihai Avatar answered Oct 15 '22 00:10

mihai


Using Powershell you can set the folder Node runs from so that it picks up the new version of Node for that instance of Powershell.

  1. Open Powershell
  2. Set the path variable to be your node folder $env:Path = "C:\yournodefolder";
  3. Running node --version should now display the version of node from your new folder.
like image 38
ryibas Avatar answered Oct 15 '22 00:10

ryibas