How you use environment variables depends on the operating system that you are using.

On Linux, you can set environment variables in a Linux bash profile or on the command line by using a command like the following.

export VI_SERVER=<your_server_name_or_address>

On Windows, you can set environment variables in the Environment properties dialog box of the System control panel. For the current session, you can set environment variables at the command line by using a command like the following.

set VI_SERVER=<your_server_name_or_address>
Important: Do not use escape characters in environment variables.

See Using ESXCLI Commands in Scripts for an environment variable example.