Force assign COM ports using command line.

Discussion in 'General Discussion' started by Fugazi, Apr 20, 2017.

  1. Fugazi

    Fugazi

    Joined:
    Jan 23, 2017
    Messages:
    5
    Likes Received:
    0
    Hi, please move if this is in the wrong place.

    I need to force Windows 10 to accept two USB devices on specific COM Ports and have come up blank on how to do this via Command Line.

    I can clear all 'hidden' devices to ensure the required COM Ports are free using the following code -

    Code (Text):
    @ECHO OFF
    FOR %%i IN (C D E F G H I J K) DO IF EXIST %%i:\remove.cmd SET Drive=%%i:
    %DRIVE%\DEVCON Find * | FIND /I /V "matching device(s)" > "%DRIVE%\DevicesExist.txt"

    FOR /F "tokens=1 delims=: " %%A IN ('%DRIVE%\DEVCON FindAll * ^| FIND /I /V "%DRIVE%\matching device(s)"') DO (
            TYPE "%DRIVE%\DevicesExist.txt" | FIND "%%~A" >NUL
           IF ERRORLEVEL 1 %Debug% %DRIVE%\DEVCON Remove "@%%~A"
    )
    Del "%DRIVE%\DevicesExist.txt"
    But when I plug in the two Devices I need to assign them to COM Port 4 & 5 respectfully .. does anyone have any idea how to go about this .. I understand it will require adjusting registry entries.

    TIA for any help
     
    Fugazi, Apr 20, 2017
    #1
    1. Advertisements

  2. Fugazi

    Regedit32 Moderator

    Joined:
    Mar 4, 2016
    Messages:
    2,617
    Likes Received:
    771
    Can you not more simply:
    • Open Device Manager
    • Expand Ports (COM & LPT)
    • Right-click on the device you want to change com port on, and select Properties
    • Select the Port Settings tab
    • Click the Advanced button
    • Select the Com you want and click OK
    Note: the device needs to plugged in and turned on to be detected in Device Manager in order to change com ports.​
     
    Regedit32, Apr 20, 2017
    #2
    Trouble likes this.
    1. Advertisements

  3. Fugazi

    Fugazi

    Joined:
    Jan 23, 2017
    Messages:
    5
    Likes Received:
    0
    Yes I could .. but I need to do it using Command line programming.
     
    Fugazi, Apr 24, 2017
    #3
  4. Fugazi

    Regedit32 Moderator

    Joined:
    Mar 4, 2016
    Messages:
    2,617
    Likes Received:
    771
    Well you could take a look at the DEVCON information page produced by Microsoft:

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

    There may be some useful information there.

    In earlier editions of Windows there was the change portX = portY command, but the problem with that is it only assigns the port while User is logged on, thus you'd have to do this each time you wished to used your device.

    To be honest I'm not even sure whether that very old MS-Dos is even supported now.

    So it seems you will need to download support packages as you apparently already have done re the DEVCON
     
    Regedit32, Apr 24, 2017
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Jackietools

    Cant assign folders to Start Menu

    Jackietools, Aug 6, 2015, in forum: Windows 10 Support
    Replies:
    13
    Views:
    1,098
    Jackietools
    Aug 6, 2015
  2. mjakachira
    Replies:
    0
    Views:
    622
    mjakachira
    Aug 19, 2015
  3. Ermiad

    SOLVED Unable to assign a drive letter.

    Ermiad, Jan 8, 2016, in forum: Windows 10 Support
    Replies:
    9
    Views:
    2,770
    Saltgrass
    Jan 8, 2016
  4. Romain B
    Replies:
    1
    Views:
    544
    Tim Locke
    Jan 20, 2016
  5. rwilson2008

    Random command line window

    rwilson2008, May 8, 2016, in forum: Windows 10 Support
    Replies:
    3
    Views:
    1,059
    Regedit32
    May 9, 2016
  6. John Ames

    SOLVED Setting up serial COM ports

    John Ames, Jun 13, 2016, in forum: Installation, Setup and Updates
    Replies:
    6
    Views:
    2,008
    Trouble
    Jun 15, 2016
  7. Bruce Wright

    Software to assign function keys?

    Bruce Wright, Aug 5, 2016, in forum: Windows 10 Support
    Replies:
    1
    Views:
    427
    bassfisher6522
    Aug 5, 2016
  8. Ronald Hirsch

    Using an installed printer on other USB ports.

    Ronald Hirsch, Apr 4, 2017, in forum: General Discussion
    Replies:
    3
    Views:
    262
    Tim Locke
    Apr 9, 2017
Loading...