CHANGE - CMD


Overview

The CHANGE command in Windows CMD is used to manage various system settings, primarily focused on services related to terminal sessions. This command can modify settings like logon permissions and COM port mappings for Remote Desktop Sessions. It is most effective in environments where multiple users access the same system remotely, such as in server management or corporate networks.

Syntax

The general syntax for the CHANGE command is as follows:

CHANGE command [options]

Where command can be one of the following:

  • logon
  • port
  • user

Each of these commands has its own specific syntax:

CHANGE LOGON {/QUERY | /ENABLE | /DISABLE}
CHANGE PORT [port1:port2] [/D] [/QUERY]
CHANGE USER {/INSTALL | /EXECUTE}
  • /QUERY, /ENABLE, and /DISABLE apply to CHANGE LOGON.
  • port1:port2 syntax and flags /D and /QUERY are used with CHANGE PORT.
  • /INSTALL and /EXECUTE are options for CHANGE USER.

Options/Flags

  • /QUERY: Displays the current status. Applicable to LOGON and PORT.
  • /ENABLE: Enables logon from client sessions. Only for LOGON.
  • /DISABLE: Disables logon from client sessions. Only for LOGON.
  • /D: Deletes the specified mapping. Only for PORT.
  • /INSTALL: Prepares the system for installation of applications. Only for USER.
  • /EXECUTE: Switches to execute mode from install mode. Only for USER.

Examples

  • View Logon Status:
    CHANGE LOGON /QUERY
    
  • Enable Logon:
    CHANGE LOGON /ENABLE
    
  • Map COM1 to COM2:
    CHANGE PORT COM1:COM2
    
  • Delete Port Mapping:
    CHANGE PORT COM1:COM2 /D
    
  • Prepare System for Installation:
    CHANGE USER /INSTALL
    
  • Switch to Execute Mode:
    CHANGE USER /EXECUTE
    

Common Issues

Users can encounter permission issues with CHANGE command, especially if run without administrative rights. Ensure to:

  1. Execute CMD with elevated privileges (Run as Administrator).
  2. Double-check the syntax used, especially the order of flags and parameters.

Integration

The CHANGE command can be used in scripts to automate the setup of user environments or to manage terminal services. For example, you could combine CHANGE with LOGOFF or SHUTDOWN commands to control user sessions and system operations effectively:

REM Prepare system for new software installation
CHANGE USER /INSTALL
REM Install software command goes here
REM Change to execute mode after installation
CHANGE USER /EXECUTE
SHUTDOWN /r
  • QUSER and QWINSTA: View session information.
  • LOGOFF: Logs off users.
  • SHUTDOWN: Shut down or reboot the system.

Further documentation on related commands can be found in the official Microsoft documentation or using the built-in Windows CMD help system by running commands like HELP QUSER.