Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Environment variables

Status
Not open for further replies.

buxtonicer1

Programmer
Sep 20, 2006
82
GB
Is there a way to set an environment variable permanently via a script ?

set Path=D:\Utils\mks\mksnt\;%Path%

This only works for the life of the shell. I know you can set the value through Control Panel > System > Advanced and so on to make it permanent.

I want to make the process dynamic. Any suggestions would be great :)
 
Would setx do the job? I think you would use it in the same way as set, but it sets the variable in the top-level shell rather than the current shell

So if you run it at a command prompt you should see the variable appear in the Control Panel > System etc list. It would then take effect for any command prompts launched afterwards.

But I can't remember if a) it is permanent (survives log off) or b) affects the current shell (command prompt) directly.

Sorry, I can't test it as we have no NT machines left, but I hope this at least sets you on a useful road.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top