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 toCHANGE LOGON
.port1:port2
syntax and flags/D
and/QUERY
are used withCHANGE PORT
./INSTALL
and/EXECUTE
are options forCHANGE USER
.
Options/Flags
- /QUERY: Displays the current status. Applicable to
LOGON
andPORT
. - /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:
- Execute CMD with elevated privileges (Run as Administrator).
- 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
Related Commands
- 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
.