set

Windows CMD · System · available in the simulator

What it does

Displays or sets environment variables in CMD.

Syntax

set [variable=[cadena]] [/p variable=texto] [/a expresión]

Options and parameters

  • /A

    Evaluates a numerical expression and assigns it to the variable.

    set /a total=2+3
  • /P

    Prompts the user for a value and assigns it to the variable.

    set /p nombre=Escribe tu nombre:

Usage examples

  • set
  • set MI_VAR=hola
  • set /a total=2+3
  • set /p nombre=Escribe tu nombre:

Notes and common mistakes

  • Without arguments, displays all environment variables for the current session.
Practise set

Related commands