How To List, Set, Get Windows Environment Variables With Set Command In Command Line MS-DOS

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-list-set-get-windows-environment-variables-with-set-command-in-command-line-ms-dos/
PINTEREST
PINTEREST
INSTAGRAM

Operating systems have a lot of configurations. These configurations are stored in different ways in different locations. One of the most common storage for some generic information like Username, operating system path etc. is environment variables. In this tutorial we will look how to list, get and set Windows operating system environment variables in details. We will use set command mainly. Set command lists, sets and gets single or all environment variables.

Help

More information about set command ca be printed with /? option.

Help
Help

Syntax

Syntax of the set command is very simple. [variable] and [string] parts are optional and used according to situation

List All Environment Variables

Environment variables holds a lot of information about the operating system and user . All these information can be listed just issuing the set command without any parameter like below.

List All Environment Variables
List All Environment Variables

Get/Print Single Environment Variable

In previous example we have listed all environment variables without selecting particular one. We can print only single variable just proving the variable name to the set command. In this example we will print the values of APPDATA environment variable.

Get/Print Single Environment Variable
Get/Print Single Environment Variable

Change/Create Environment Variable

Now the last function of the set command. We can create  or change and environment variable and its value by giving both the variable name and the variable data. In this example we create a new variable named Test with value 1

Get Home Path

Home is the current users location where his personal files and folders stored. This path can be printed like below.

LEARN MORE  In Python Operator Usage Tutorial with Examples

Get Logon Server

Logon server is used to authenticate the user to login a system. In active directory system user credentials are authenticated in these authority servers.

Get Path Variable

Path variable is used to find executable files. Path variable stored more than one path and if a command is issued these path are checked for this command executables to run.

Get Program Files Path

Windows operating system stores built-in and 3 party applications files and folder in Program Files directory. This directory path can be printed like below.

Get System Root

Windows operating system files, folders and libraries are stored in System Root and this root directory generally named windows . By default this path is C:\Windows . The system root can be printed like below.

Get Username

The currently logged users user name can be printed like below.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-list-set-get-windows-environment-variables-with-set-command-in-command-line-ms-dos/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.