EuroFight Posted August 2, 2013 Posted August 2, 2013 Hi everyone, I am writing a batch script to be pushed out to systems that will modify the system 'Path' environment variable using the SETX command. My current code looks like this: SETX Path "C:\Program Files (x86)\Internet Explorer\iexplore.exe;"+Path /M pause However, I wish to retain the current path variables as well as creating the new one. Is there a way to add to the variable instead of simply replacing it? Thanks, Euro Share this post Link to post Share on other sites More sharing options...
CheeseMan42 Posted August 2, 2013 Posted August 2, 2013 I'm not sure how to do it on Windows but on Linux you would use something like export PATH=$PATH:/new/path so maybe there is similar syntax in Windows land. Share this post Link to post Share on other sites More sharing options...
EuroFight Posted August 2, 2013 Posted August 2, 2013 Okay eventually I found a workaround, essentially I created a registry key containing the contents of 'Path' as well as my modified code reg add HKCU\Temp /v SetEnvPathTemp /t reg_multi_sz /d "C:\Program Files (x86)\Internet Explorer\iexplore.exe;%Path%" Then I exported the contents of the registry key to the path variable setx Path /k "HKCU\Temp\SetEnvPathTemp" /M It's a long way around it but it got the job done Share this post Link to post Share on other sites More sharing options...
rivalary Posted August 2, 2013 Posted August 2, 2013 setx PATH "%PATH%;C:\Program Files (x86)\Internet Explorer\iexplore.exe" Works for me. Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now