Berming
Berming

Reputation: 1302

Can a script.bat make changes to Windows PATH Environment Variable

I'm trying to write a script that when clicked will add a couple of entries to the PATH Environment variable in Windows, instead of making the changes manually. I see .bat files being used all the time on Windows for a variety of reasons, so can a .bat script help me with something like that?

I actually need to download a zip from a location on the Internet, extract it to a specified location, then update the PATH in environment variable. Never done this before so any hints appreciated.

Upvotes: 17

Views: 42504

Answers (1)

drhanlau
drhanlau

Reputation: 2527

If you wish to change/update the PATH permanently in the environment variable, you can use the SETX command e.g.

setx path "%PATH%;C:\New Folder" 

For more details information on %PATH% and other variables to access to system folder, refer to http://vlaurie.com/computers2/Articles/environment.htm

Upvotes: 38

Related Questions