본문 바로가기
life.hack

숨겨진 COM Port 삭제

by 조브 2020. 6. 18.

 

 

컴퓨터와 다양한 장치(Arduino, Virtual COM Port)를 시리얼 포트로 연결하다 보면, 아래와 같이 COM Port번호가 두자리수를 훌쩍 넘어가게 됩니다.

 

 

조금 지저분해보여도 쓰는데, 사용에 지장이 없다면 문제가 없겠지만, 때때로 어떤 프로그램에서는 특정 자릿수까지의 COM Port 번호만 사용하는 프로그램도 있습니다.

이런 경우, COM Port의 번호를 강제로 조절하거나, 사용하지 않는 COM Port를 삭제해 주어야합니다.

 

 



사용하지 않는 숨겨진 COM Port를 삭제 하는 2가지 방법에 대해서 알아봅니다.

 

 


1. Windows 키 + R을 눌러 cmd을 입력합니다. 커맨드 창에 set devmgr_show_nonpresent_devices=1 를 입력합니다. 

set devmgr_show_nonpresent_devices=1

 

이후 장치관리자를 열어줍니다.

devmgmt.msc

 

 

장치관리자에서 보기(V) > 숨겨진 장치 표시(W)를 체크하면 숨겨진 포트를 확인할 수 있으며, 마우스 우클릭으로 디바이스 제거(U)를 할 수 있습니다.

 

 

 

 

 

 

 



2. 두번째 방법은 devcon.exe를 사용하는 방법입니다.

 

 

decon.exe는 디바이스 콘솔로 장치에 대한 정보 및 설정을 할 수 있는 프로그램입니다.

DevCon (Devcon.exe), the Device Console, is a command-line tool that displays detailed information about devices on computers running Windows. You can use DevCon to enable, disable, install, configure, and remove devices.

 

 

 

devcon.exe를 다운로드하는 방법은 아래 링크에 설명되어 있습니다만, 상당히 복잡합니다.

 

 

 

https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon

 

Windows Device Console (Devcon.exe) - Windows drivers

DevCon (Devcon.exe), the Device Console, is a command-line tool that displays detailed information about devices on computers running Windows.

docs.microsoft.com

 

 

devcon.exe만 따로 받는 방법은 없고 Visual Studio, Windows SDK, WDK를 설치해야합니다. (구글링 해보시면 devcon.exe만 추출하는 방법은 있습니다)

 

셋다 설치하시면, 아래 경로에서 확인하실 수 있습니다.

 

 

32비트:

C:\Program Files (x86)\Windows Kits\10\Tools\x86\devcon.exe

 

 

64비트:

C:\Program Files (x86)\Windows Kits\10\Tools\x64\devcon.exe

 

 

 

상당히 번거롭기 때문에 혹시나 필요로 하신 분들을 위해 첨부파일로 남깁니다. 윈도우 10용 입니다.

 

devcon.zip
0.05MB




사용법은 아래 링크에서 확인하실 수 있습니다.

https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-general-commands

 

Device Console (DevCon.exe) Commands - Windows drivers

DevCon (DevCon.exe) is a command line tool that can display detailed information about devices on computers running Windows. You can also use DevCon to enable, disable, install, configure, and remove devices. DevCon uses the following syntax.

docs.microsoft.com

 

 

시리얼 장치를 모두 찾는 방법은 커맨드 창에서 아래와 같이 입력합니다.

 

devcon findall =ports

 그럼 아래와 같이 출력됩니다.

 

 

 

다음으로 Com Port를 삭제해 보도록 하겠습니다. 이때는 관리자 권한으로 cmd를 실행하셔야 합니다.

 

아래와 같이 앞서 찾은 장치의 ID값을 사용하여 Com Port를 삭제할 수 있습니다. @"ID"로 사용합니다.

 

devcon remove @"USB\VID_1A86&PID_7523\6&1B853A7&0&2"

 

 

 

 

다음에는 devcon.exe를 이용하여 간단한 윈폼 애플리케이션을 만들어 보겠습니다.

 

 


https://dream-hacker.tistory.com/37

 

Com Port Cleaner (시리얼포트 정리기)

이번에는 지난번 포스트에서 사용한 devcon.exe를 편하게 사용하기 위한 간단한 GUI 프로그램을 만들어 보도록 하겠습니다. 저는 윈도우 10 64bit에서 Visual Studio 2019로 작업하였습니다. devcon.exe 설치 �

dream-hacker.tistory.com

 

댓글