Click here to Skip to main content
15,884,906 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how i can insert STX and ETX command

What I have tried:

I want to insert STX and ETX command into text format and want key pad instruction that how it can insert..
Posted
Updated 1-Jan-22 3:39am
Comments
Richard MacCutchan 8-Nov-21 5:30am    
STX is hexadecimal value 0x02, and ETX is 0x03. I am not sure that you can generate these directly via cmd, so you most likely need to write program to do it.
0x01AA 8-Nov-21 6:11am    
STX is often Ctrl&B
ETX is often Ctrl&C
CR is often Ctrl&M
When you have a look to the sacii table you will find the logic:
https://de.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange#/media/Datei:USASCII_code_chart.png

You mentioned command line, whatever this means...

Now in past (very past) when one need to control external devices by 'type writers' aka 'terminals' it was very common to send control codes by Ctrl&<x>
What means now <x>?
Have a look to the Ascii table e.g. here File:ASCII-Table-wide.svg - Wikipedia[^] and also American Standard Code for Information Interchange – Wikipedia[^] (where you find STX, ETX)

And let us first have a look to <cr>, Carriage return, decimal 13. Third row right you will find character 'M'.
Don't ask me from where it comes but Ctrl&M will perfrom a 'Carriage return' (and this still works e.g. in notepad).
And same is/was valid for other control characters, so Ctrl&B was/is(?) STX etc.

So, for every control character in the very past you could use Ctrl&<x> to send a control character.
In your case
STX is Ctrl&B
ETX is Ctrl&C

Sorry for my English ;)
 
Share this answer
 
v2
To echo your control character, try use a method that allows echoing/converting hexadecimal to character, some like: echo(0x02StringsToSend0x03 to: ☻StringsToSend♥
CMD/BAT
@echo off 

for /f "delims= " %%S in ('forFiles /p "." /m "%~nx0" /c "cmd /c echo(0x02StringsToSend0x03"')do echo\%%S
You can also use your strings as an argument for your bat:
CMD/BAT
@echo off

rem :: your argument: "%~1"

for /f "delims= " %%S in ('forFiles /p "." /m "%~nx0" /c "cmd /c echo(0x02%~10x03"')do echo\%%S

-----------------------------------------------------
>rem./ in command-line use:
>Bat_Send_String.cmd StringsToSend
☻StringsToSend♥
To use just one line:
CMD/BAT
@for /f "delims= " %%S in ('forFiles /p "." /m "%~nx0" /c "cmd /c echo(0x02strings0x03"')do @echo\%%S
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900