Author Topic: Sending character or string through Command prompt  (Read 1990 times)

0 Members and 1 Guest are viewing this topic.

Offline sanka1pTopic starter

  • Contributor
  • Posts: 26
  • Country: us
Sending character or string through Command prompt
« on: November 09, 2023, 10:36:19 pm »
Hi All,

I am trying to send a string for example "BB" just BB through CMD of windows 11. I looked it up on internet and couldn't find anything that worked for me. I specifically tried this command "set /p x="BB" <nul >\\.\COM17" and it didnt work as I didn't receive any thing on the other side. I did set the Baud rate before trying this command. Please let me know, if someone knows any commands that works. Thank you.
Using Analog in a Digital world.
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7625
  • Country: us
  • hp>Agilent>Keysight>???
Re: Sending character or string through Command prompt
« Reply #1 on: November 09, 2023, 11:22:28 pm »
Why don't you just get a simple serial terminal program like termite?
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1447
  • Country: us
  • Very dangerous - may attack at any time
Re: Sending character or string through Command prompt
« Reply #2 on: November 09, 2023, 11:33:57 pm »
echo test >\\.\COM17
 

Offline pickle9000

  • Super Contributor
  • ***
  • Posts: 2439
  • Country: ca
Re: Sending character or string through Command prompt
« Reply #3 on: November 09, 2023, 11:45:19 pm »
don't forget to use mode to open the port first
 

Offline sanka1pTopic starter

  • Contributor
  • Posts: 26
  • Country: us
Re: Sending character or string through Command prompt
« Reply #4 on: November 10, 2023, 02:59:10 am »
Why don't you just get a simple serial terminal program like termite?
That’s the whole point of doing this. Don’t want to use any special application.
Using Analog in a Digital world.
 

Offline sanka1pTopic starter

  • Contributor
  • Posts: 26
  • Country: us
Re: Sending character or string through Command prompt
« Reply #5 on: November 10, 2023, 02:59:52 am »
echo test >\\.\COM17
tried this too. Didn’t work
Using Analog in a Digital world.
 

Offline sanka1pTopic starter

  • Contributor
  • Posts: 26
  • Country: us
Re: Sending character or string through Command prompt
« Reply #6 on: November 10, 2023, 03:00:58 am »
don't forget to use mode to open the port first
used mode to set the baud rate, parity and stop bit for this com port
Using Analog in a Digital world.
 

Offline 50ShadesOfDirt

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Re: Sending character or string through Command prompt
« Reply #7 on: November 11, 2023, 04:23:06 pm »
I haven't needed to do this (write to com port from cli), so didn't have the commands at hand ... some quick googling yields things like:

  mode com1: baud=9600 data=8 parity=n stop=1
  copy con com1
  alt+18alt+2ctrl+z

I use this form of filesystems pathing at times, and it is something like:
  dir \\.\C:\temp
so, you might be able to construct something like:
  echo test > \\.\COM17\

If you are open to using powershell at the command line of a CMD shell, then perhaps this:
  https://learn.sparkfun.com/tutorials/terminal-basics/command-line-windows-mac-linux

All of this requires an effort to learn more about the historical way it was done in dos (precursor to windows shells), and all the newer ways up to and including the CMD shell in the latest versions of windows, and/or the Powershell way of things at the CMD prompt.

If you don't want to go down *that* learning path, then I hope the above gets you closer ... again, google the crap out of it ...
« Last Edit: November 11, 2023, 04:26:03 pm by 50ShadesOfDirt »
 
The following users thanked this post: sanka1p


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf