Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Line Option to select a specific Com Port

Status
Not open for further replies.

gmacted

Programmer
Mar 16, 2007
6
US
Is there a command line option to start Procomm using a specific Com Port? I would like to open multiple windows, using a batch file, each using a different (and specific) Com Port.
 
I used this in an old script and it worked fine.

set modem connection "direct connect-Com2
 
As SAMMEE2 mentioned, set modem connection is the command you want to use. This can't be set in the command line per se, but you could include the name of a script containing this command in the command line that you use to launch Procomm Plus.

 
Thanks for the reply, but I know how to change the modem connection in a script and I already do that. I am trying to use a batch file to open multiple instances of Procomm each with a specific Com Port. I was hoping to do it at the command line. Any other suggestions?
 
There is no direct way to do it via the command line. If you add a script that sets the connection to your command line, then you can specify the connection (via your script) in that manner.

 
The only problem with that is that I would have to have seperate scripts for each window/com port. I want to run the same script in each window/com port.
 
The only other option I can think of then would be to pass the name of the connection via the command line and have your script set that particular connection. Here is some more information from the help file that I copied from my site:

You can pass variables to Procomm Plus via the command line used to start the application. For example, the command line "C:\Program Files\Symantec\Procomm Plus\Programs\PW5.exe myscript.wax test" will launch Procomm Plus, execute the script myscript.wax and place the word test in the predefined global string variable s0. Up to 10 values may be passed in. The values will be placed in the global strings s0 through s9, and the number of passed variables will be placed in the predefined global integer i0. Your script can then use the atoi, atol, or atof commands to convert the string values to integers, longs, or floats, if necessary.

 
That worked perfectly!

Here is the code I wrote:

integer port_num

;see if there is a command line option being passed
atoi s0 port_num
if port_num > 0
set modem connection port_num
s0 = "0"
exit
endif

The batch file command looks like this:

start pw5.exe <scriptname>.wax 3

The above call will start a Procomm window with Com Port 3 as the com port.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top