Skip to content

CHGPORT Windows command

The Windows chgport command is a command-line utility that allows users to change the port number settings for COM and LPT ports on a Windows computer. By using the chgport command, users can easily modify the configuration of these ports to suit their specific needs. This can be especially useful in situations where the default port settings are not ideal or compatible with the connected devices. The chgport command provides a simple and efficient way to manage port settings without the need for complex GUI tools.

CHGPORT Syntax:

Terminal window
chgport [options] [parameters]

Windows CHGPORT Options:

OptionDescription
/queryDisplay current port mappings
/deleteDelete a port mapping
/addAdd a port mapping

CHGPORT Parameters:

ParameterDescription
portSpecifies the port number
targetSpecifies the target IP address

How to use CHGPORT command:

Change the COM port for a device

Terminal window
chgport COM1=COM3

This command changes the COM port for a device from COM1 to COM3.

Display the current COM port mappings

Terminal window
chgport

This command displays the current COM port mappings on the system.

Add a new COM port mapping

Terminal window
chgport COM5=COM7

This command adds a new COM port mapping, assigning COM7 to be the new port for device previously connected to COM5.

Remove a COM port mapping

Terminal window
chgport /delete COM2

This command removes the COM port mapping for COM2, disconnecting any devices previously connected to this port.

Revert a COM port mapping

Terminal window
chgport /revert COM6

This command reverts the changes made to the COM port mapping for COM6 to its default configuration.

Change the LPT port for a device

Terminal window
chgport LPT1=LPT2

This command changes the LPT port for a device from LPT1 to LPT2.

Display the current LPT port mappings

Terminal window
chgport /lpt

This command displays the current LPT port mappings on the system.

Disable a specific port mapping

Terminal window
chgport /delete LPT2

This command disables the LPT2 port mapping, preventing any devices from using this port.

How do I use chgport in CMD?

To use the chgport command in CMD, execute the following command:

Terminal window
chgport --option <value>

What is the purpose of the chgport command in Windows CMD?

The chgport command is used to change the COM port parameters for a specific serial port in Windows.

Terminal window
chgport COM1 /baudrate 9600

How can I list all the available options for the chgport command?

You can view all the available options for the chgport command by using the /? flag.

Terminal window
chgport /?

How do I change the baud rate of a specific COM port using chgport?

To change the baud rate of a specific COM port, you can use the following syntax:

Terminal window
chgport COM2 /baudrate 115200

Can I disable a COM port with the chgport command?

Yes, you can disable a COM port using the chgport command by setting the baud rate to 0.

Terminal window
chgport COM3 /baudrate 0

How do I reset the settings of a COM port to default using chgport?

To reset the settings of a COM port to default, you can specify the default settings for all parameters.

Terminal window
chgport COM4 /baudrate 9600 /bytesize 8 /parity N /stopbits 1

Is it possible to change multiple parameters of a COM port at once with chgport?

Yes, you can change multiple parameters of a COM port simultaneously by specifying all the desired parameters.

Terminal window
chgport COM5 /baudrate 57600 /bytesize 7 /parity E /stopbits 2

How can I confirm that the changes made with the chgport command are applied?

You can verify that the changes made with the chgport command are applied by checking the properties of the respective COM port in Device Manager.

Terminal window
chgport COM1 /baudrate 4800

What should I do if I encounter errors while using the chgport command?

If you encounter errors while using the chgport command, ensure that you have administrative privileges and that the port you are trying to modify is not in use by another application.

Terminal window
chgport COM3 /baudrate 2400 /bytesize 7

Applications of the CHGPORT Command

  • Change the COM port or LPT port number mappings for devices.