Skip to main content
added some description
Source Link
Premraj
  • 2.3k
  • 2
  • 20
  • 25

Actually we can set variable at three scopes:

  1. Shell
  2. User
  3. System (Machine) or Global

SET : Create or Update the current shell scope for temporary.

C:\Users\977246>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

  variable  Specifies the environment-variable name.
  string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

SETX : Create or Update the current user environment variables for permanent.

C:\Users\977246>setx /?

SetX has three ways of working:

Syntax 1:
    SETX [/S system [/U [domain\]user [/P [password]]]] var value [/M]

Syntax 2:
    SETX [/S system [/U [domain\]user [/P [password]]]] var /K regpath [/M]

Syntax 3:
    SETX [/S system [/U [domain\]user [/P [password]]]]
         /F file {var {/A x,y | /R x,y string}[/M] | /X} [/D delimiters]

Description:
    Creates or modifies environment variables in the user or system
    environment. Can set variables based on arguments, regkeys or
    file input.

To remove the variable set value to empty string as follows

Example: setx path ""

In GUI User and System environment variables.

enter image description here

Actually we can set variable at three scopes:

  1. Shell
  2. User
  3. System (Machine) or Global

SET : Create or Update the current shell scope.

C:\Users\977246>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

  variable  Specifies the environment-variable name.
  string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

SETX : Create or Update the current user environment variables.

C:\Users\977246>setx /?

SetX has three ways of working:

Syntax 1:
    SETX [/S system [/U [domain\]user [/P [password]]]] var value [/M]

Syntax 2:
    SETX [/S system [/U [domain\]user [/P [password]]]] var /K regpath [/M]

Syntax 3:
    SETX [/S system [/U [domain\]user [/P [password]]]]
         /F file {var {/A x,y | /R x,y string}[/M] | /X} [/D delimiters]

Description:
    Creates or modifies environment variables in the user or system
    environment. Can set variables based on arguments, regkeys or
    file input.

To remove the variable set value to empty string as follows

Example: setx path ""

In GUI User and System environment variables.

enter image description here

Actually we can set variable at three scopes:

  1. Shell
  2. User
  3. System (Machine) or Global

SET : Create or Update the current shell scope for temporary.

C:\Users\977246>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

  variable  Specifies the environment-variable name.
  string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

SETX : Create or Update the current user environment variables for permanent.

C:\Users\977246>setx /?

SetX has three ways of working:

Syntax 1:
    SETX [/S system [/U [domain\]user [/P [password]]]] var value [/M]

Syntax 2:
    SETX [/S system [/U [domain\]user [/P [password]]]] var /K regpath [/M]

Syntax 3:
    SETX [/S system [/U [domain\]user [/P [password]]]]
         /F file {var {/A x,y | /R x,y string}[/M] | /X} [/D delimiters]

Description:
    Creates or modifies environment variables in the user or system
    environment. Can set variables based on arguments, regkeys or
    file input.

To remove the variable set value to empty string as follows

Example: setx path ""

In GUI User and System environment variables.

enter image description here

added some description
Source Link
Premraj
  • 2.3k
  • 2
  • 20
  • 25

Actually we can set variable at three scopes:

  1. Shell
  2. User
  3. MachineSystem (Machine) or Global

SET : Create or Update the current shell scope.

C:\Users\977246>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

  variable  Specifies the environment-variable name.
  string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

SETX : Create or Update the current user environment variables.

C:\Users\977246>setx /?

SetX has three ways of working:

Syntax 1:
    SETX [/S system [/U [domain\]user [/P [password]]]] var value [/M]

Syntax 2:
    SETX [/S system [/U [domain\]user [/P [password]]]] var /K regpath [/M]

Syntax 3:
    SETX [/S system [/U [domain\]user [/P [password]]]]
         /F file {var {/A x,y | /R x,y string}[/M] | /X} [/D delimiters]

Description:
    Creates or modifies environment variables in the user or system
    environment. Can set variables based on arguments, regkeys or
    file input.

To remove the variable set value to empty string as follows

Example: setx path ""

In GUI User and System environment variables.

enter image description here

Actually we can set variable at three scopes:

  1. Shell
  2. User
  3. Machine or Global

SET : Create or Update the current shell scope.

C:\Users\977246>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

  variable  Specifies the environment-variable name.
  string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

SETX : Create or Update the current user environment variables.

C:\Users\977246>setx /?

SetX has three ways of working:

Syntax 1:
    SETX [/S system [/U [domain\]user [/P [password]]]] var value [/M]

Syntax 2:
    SETX [/S system [/U [domain\]user [/P [password]]]] var /K regpath [/M]

Syntax 3:
    SETX [/S system [/U [domain\]user [/P [password]]]]
         /F file {var {/A x,y | /R x,y string}[/M] | /X} [/D delimiters]

Description:
    Creates or modifies environment variables in the user or system
    environment. Can set variables based on arguments, regkeys or
    file input.

To remove the variable set value to empty string as follows

Example: setx path ""

Actually we can set variable at three scopes:

  1. Shell
  2. User
  3. System (Machine) or Global

SET : Create or Update the current shell scope.

C:\Users\977246>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

  variable  Specifies the environment-variable name.
  string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

SETX : Create or Update the current user environment variables.

C:\Users\977246>setx /?

SetX has three ways of working:

Syntax 1:
    SETX [/S system [/U [domain\]user [/P [password]]]] var value [/M]

Syntax 2:
    SETX [/S system [/U [domain\]user [/P [password]]]] var /K regpath [/M]

Syntax 3:
    SETX [/S system [/U [domain\]user [/P [password]]]]
         /F file {var {/A x,y | /R x,y string}[/M] | /X} [/D delimiters]

Description:
    Creates or modifies environment variables in the user or system
    environment. Can set variables based on arguments, regkeys or
    file input.

To remove the variable set value to empty string as follows

Example: setx path ""

In GUI User and System environment variables.

enter image description here

added 111 characters in body
Source Link
Premraj
  • 2.3k
  • 2
  • 20
  • 25

Actually we can set variable at three scopes:

  1. Shell
  2. User
  3. Machine or Global

SET : UpdatedCreate or Update the current shell onlyscope.

C:\Users\977246>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

  variable  Specifies the environment-variable name.
  string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

SETX : updateCreate or Update the current user environment variables.

C:\Users\977246>setx /?

SetX has three ways of working:

Syntax 1:
    SETX [/S system [/U [domain\]user [/P [password]]]] var value [/M]

Syntax 2:
    SETX [/S system [/U [domain\]user [/P [password]]]] var /K regpath [/M]

Syntax 3:
    SETX [/S system [/U [domain\]user [/P [password]]]]
         /F file {var {/A x,y | /R x,y string}[/M] | /X} [/D delimiters]

Description:
    Creates or modifies environment variables in the user or system
    environment. Can set variables based on arguments, regkeys or
    file input.

To remove the variable set value to empty string as follows

Example: setx path ""

SET : Updated the current shell only.

C:\Users\977246>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

  variable  Specifies the environment-variable name.
  string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

SETX : update the current user environment variables.

C:\Users\977246>setx /?

SetX has three ways of working:

Syntax 1:
    SETX [/S system [/U [domain\]user [/P [password]]]] var value [/M]

Syntax 2:
    SETX [/S system [/U [domain\]user [/P [password]]]] var /K regpath [/M]

Syntax 3:
    SETX [/S system [/U [domain\]user [/P [password]]]]
         /F file {var {/A x,y | /R x,y string}[/M] | /X} [/D delimiters]

Description:
    Creates or modifies environment variables in the user or system
    environment. Can set variables based on arguments, regkeys or
    file input.

To remove the variable set value to empty string as follows

Example: setx path ""

Actually we can set variable at three scopes:

  1. Shell
  2. User
  3. Machine or Global

SET : Create or Update the current shell scope.

C:\Users\977246>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

  variable  Specifies the environment-variable name.
  string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

SETX : Create or Update the current user environment variables.

C:\Users\977246>setx /?

SetX has three ways of working:

Syntax 1:
    SETX [/S system [/U [domain\]user [/P [password]]]] var value [/M]

Syntax 2:
    SETX [/S system [/U [domain\]user [/P [password]]]] var /K regpath [/M]

Syntax 3:
    SETX [/S system [/U [domain\]user [/P [password]]]]
         /F file {var {/A x,y | /R x,y string}[/M] | /X} [/D delimiters]

Description:
    Creates or modifies environment variables in the user or system
    environment. Can set variables based on arguments, regkeys or
    file input.

To remove the variable set value to empty string as follows

Example: setx path ""
Source Link
Premraj
  • 2.3k
  • 2
  • 20
  • 25
Loading