How to create a windows environment variable

Asked

Viewed 1,292 times

2

I need to create an environment variable in windows, through a batch.

I can create a local variable with

set variavel=valor

But I need to access this value through other batch. how do I create a windows variable?

1 answer

2


To create an environment variable it is necessary to have administrator privileges, so just use the command setx

Example:

setx NOME valor
  • And if I want to delete this variable in the future, which command do I use?

  • Thanks @rray :)

  • @Laércio Lopes REG delete HKCU Environment /F /V NAME removes the variable.. more details on that reply

Browser other questions tagged

You are not signed in. Login or sign up in order to post.