Batch file to add variable to PATH


Under system properties - Environment Variables - System variables - the Variable PATH I want to add the following ;C:\Program Files\Internet Explorer.

I have attached a screen shot.

I want to do this by using a batch script and I want to add to the existing variable.



Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

My Quick Question do you want to store the changes permanently? or for runtime only.

in case you want to use for the current batchfile you can use the following command

SET PATH=%PATH%;new path

This will add your new path to existing list of PATHs

luketrAuthor Commented:
I've just tried it and it hasn't work, i need the change to be done permanetly.

SET PATH=%PATH%;C:\Program Files\Internet Explorer

You can use SETX to permanently set the PATH.

SETX PATH yourpath

Run SETX /? for help.

Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

1. You are required to surround path containing spaces with "" 
2. In order to make permanent changes for the system you need to administrative access to the system would be required. you could choose to use one of following methods
a) SETX.exe .. it had been available post Win XP SP 2 this works the same way as SET command, but makes permanent changes
b) use reg command to programatically set  registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment for the value of PATH

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You could use setx.exe from the Windows Resource kit or from M$ download:

Alternatively you can edit the registry key for "Path" in
The problem with changing registry keys is if you screw up the registry path your machine will become unusable - so be careful!

There's also the question of whether it's the local user's path or the system one for all users that you want to change.

There is a third party program called editpath which is reputedly good, but I haven't had firsthand experience:
That'll teach me not to leave a session open for a couple of hours before returning to a question - looks like pritamdutt beat me to most of that!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.