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-linuxAll 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 ...