set environment variable from batch

DDK

When I set a environment variable envir using setx command, It seems to not actually 'set' in environment.

setx envir "windows"
if 1==1 (
    setx envir "unix"
)
echo %envir%
set

The set command displays a list of environment variable but it doesn't display the variable which was currently set by the previous line.

Axel Kemper

In your example, the environment variable %ENVIR% is set to "windows". This is stored in the user-specific environment variables in the Windows registry. The change is not directly reflected in the environments of currently active processes.

To actually see this new setting via set command, you have to open a new command box using cmd.exe. The current command box does not automatically re-read changed settings from the registry. You could also use the system control SYSTEM and look under Extended Properties / Environment:

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Environment variable not set, from Netbeans

From Dev

Environment variable not set, from Netbeans

From Dev

Evaluate environment variable read from file in batch

From Dev

Evaluate environment variable read from file in batch

From Dev

How to set PATH environment variable in batch file only once on Windows?

From Dev

How to set PATH environment variable in batch file only once on Windows?

From Dev

nodejs app doesn't recognise batch environment variable set before

From Dev

How to export environment variable set in perl script to batch shell?

From Dev

set an annotation attribute from an environment variable?

From Dev

How to set Jenkins environment variable from script

From Dev

How to set `screen` environment variable from bash?

From Dev

grid-size from environment variable in Spring Batch

From Dev

Windows Batch Command : How to dereference FOR loop variable to check if that variable is SET in Environment Variable

From Dev

Windows Batch Command : How to dereference FOR loop variable to check if that variable is SET in Environment Variable

From Dev

How to set a variable with an environment variable read from a text file

From Dev

zsh PATH variable not properly set from another environment variable

From Dev

Batch File: "Environment Variable Not Defined"

From Dev

Batch: set a variable with a filename

From Dev

Set filename as variable in BATCH

From Dev

GOPATH environment variable not set

From Dev

Laravel set environment variable

From Dev

Set environment variable for subshell

From Dev

Is there an environment variable that is set for Unity?

From Dev

Where is this environment variable set?

From Dev

Set environment variable

From Dev

Batch file - set variable in “if” then "set"

From Dev

Batch file - set variable in “if” then "set"

From Dev

Reading Value from Text file to set in batch file variable

From Dev

How to use batch command "where" and set a variable from a VBScript?

Related Related

  1. 1

    Environment variable not set, from Netbeans

  2. 2

    Environment variable not set, from Netbeans

  3. 3

    Evaluate environment variable read from file in batch

  4. 4

    Evaluate environment variable read from file in batch

  5. 5

    How to set PATH environment variable in batch file only once on Windows?

  6. 6

    How to set PATH environment variable in batch file only once on Windows?

  7. 7

    nodejs app doesn't recognise batch environment variable set before

  8. 8

    How to export environment variable set in perl script to batch shell?

  9. 9

    set an annotation attribute from an environment variable?

  10. 10

    How to set Jenkins environment variable from script

  11. 11

    How to set `screen` environment variable from bash?

  12. 12

    grid-size from environment variable in Spring Batch

  13. 13

    Windows Batch Command : How to dereference FOR loop variable to check if that variable is SET in Environment Variable

  14. 14

    Windows Batch Command : How to dereference FOR loop variable to check if that variable is SET in Environment Variable

  15. 15

    How to set a variable with an environment variable read from a text file

  16. 16

    zsh PATH variable not properly set from another environment variable

  17. 17

    Batch File: "Environment Variable Not Defined"

  18. 18

    Batch: set a variable with a filename

  19. 19

    Set filename as variable in BATCH

  20. 20

    GOPATH environment variable not set

  21. 21

    Laravel set environment variable

  22. 22

    Set environment variable for subshell

  23. 23

    Is there an environment variable that is set for Unity?

  24. 24

    Where is this environment variable set?

  25. 25

    Set environment variable

  26. 26

    Batch file - set variable in “if” then "set"

  27. 27

    Batch file - set variable in “if” then "set"

  28. 28

    Reading Value from Text file to set in batch file variable

  29. 29

    How to use batch command "where" and set a variable from a VBScript?

HotTag

Archive