Modifying the System Path variable from cmd

2

I am trying to modify my system Path value. I need this as I am doing an upgrade of the S/W and the users need to have access to the old and new system. I provide them with a toggle button which will change the settings and let them use both.

One of the things I need to do for this is change the system path value. I have a .reg file to do this. When I run this script, I get the message "The keys and values contained in have been successfully added to the registry"

But I do not see the change reflected when I go and check my registry.

My Original value for System Path is:

C:\Oracle01\product\11.2.0\client_1\bin;C:\Program Files\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Infor\Unify\Runtime52\;C:\Program Files\QuickTime\QTSystem\;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\

My reg file is as below


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
"Path"="REG_EXPAND_SZ:C:\Oracle01\product\11.2.0\client_1\bin;C:\Program Files\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Visual\RunTime40\;C:\Program Files\QuickTime\QTSystem\;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\"

I want entry C:\Infor\Unify\Runtime52\ to change to c:\Visual\RunTime40\ in the path.

Pls let me know what I am missing here. My reg file is in my local C drive.

Thanks, Vidya.

Vidya

Posted 2014-07-10T14:08:09.253

Reputation: 21

I might be misunderstanding the situation here but can you not edit or add new environmental variables? – Samuel Nicholson – 2014-07-10T14:13:28.840

1system path or registry key? they are very different, one you do via regedit <file>.reg and the other via SET – Quijote Shin – 2014-07-10T14:32:14.810

I want to edit the system Path. I tried changing the registry for it. – Vidya – 2014-07-10T15:28:50.647

I finally tried this and it worked. SETX -M PATH "C:\Oracle01\product\11.2.0\client_1\bin;C:\Program Files\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;c:\Visual\RunTime40;C:\Program Files\QuickTime\QTSystem;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\ManagementStudio;c:\Program Files\Microsoft SQL Server\110\Tools\Binn;c:\Program Files\Microsoft SQL Server\110\DTS\Binn"

I now want to put this in a batch file. – Vidya – 2014-07-10T15:29:16.633

Answers

0

As in comments

To change your local paths you do it via console, you use SET commands, so with it you can

View your available enviroment variable list

SET

Create a new env variable

SET newenv=hello;

Update a variable

SET newenv=%newenv%cya;

Can pint it out

echo %newenv%
SET %newenv%

At system registry keys

you can

registry /s <file>.reg

/s is for silent.

Quijote Shin

Posted 2014-07-10T14:08:09.253

Reputation: 195

I finally tried this and it worked.

SETX -M PATH "C:\Oracle01\product\11.2.0\client_1\bin;C:\Program Files\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;c:\Visual\RunTime40;C:\Program Files\QuickTime\QTSystem;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\ManagementStudio;c:\Program Files\Microsoft SQL Server\110\Tools\Binn;c:\Program Files\Microsoft SQL Server\110\DTS\Binn" – Vidya – 2014-07-10T15:33:06.853

I now want to put this in a batch file. I have admin rights , so I did not have to run as admin. In case of other users without admin access will this work? – Vidya – 2014-07-10T15:33:29.903

can't accurate it , anyway I can't understand your environment. You seems to be at an enterprise network, If so , as domain admin you can remote execute everything – Quijote Shin – 2014-07-10T15:49:58.740