Computing.Net > Forums > Disk Operating System > Read Serial Port from DOS

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Read Serial Port from DOS

Reply to Message Icon

Original Message
Name: Lucy-Jo
Date: December 12, 2003 at 06:22:00 Pacific
Subject: Read Serial Port from DOS
OS: Win XP home
CPU/Ram: Pentium - 512k
Comment:


I have a device connected to my serial port which is putting data into my serial port.

I want to use a DOS command to read the incoming data.

I've tried:-

COPY com1 text.txt

But that just hangs DOS.

How can I get strings of text coming in through the serial port to a file so I can process the text?

Thanks!



Report Offensive Message For Removal


Response Number 1
Name: IVO
Date: December 12, 2003 at 07:47:47 Pacific
Reply: (edit)

Stated that XP has no DOS at all, only an emulator (NTVDM) working side by side with the NT System Console (the so called DOS Prompt), you need a device driver and, may be, a specific application to process data from your serial device.
Copy *sends* data from a file to a port, not backward.
Anyway there is no DOS/NT command to accomplish your (at first sight) easy job.


Report Offensive Follow Up For Removal

Response Number 2
Name: Wengier
Date: December 12, 2003 at 09:06:59 Pacific
Reply: (edit)

The NT System Console is actually called "(NT) Command Prompt" in WinNT/2K/XP, not "DOS Prompt"(as in Win3.x/9x).

I would suggest the webmaster of Computing.Net to open a separate "WinNT Console Forum" or "WinNT Console Batch Forum" because we don't want to state "WinNT/2K/XP has no DOS at all" over and over.



Report Offensive Follow Up For Removal

Response Number 3
Name: x86
Date: December 12, 2003 at 09:56:58 Pacific
Reply: (edit)

HERE! HERE! totally agree Weinger, looking forward to no VDM in the replacement for XP!

As to using DOS in NT see:

http://www.windowsitlibrary.com/Content/226/03/1.html


Report Offensive Follow Up For Removal

Response Number 4
Name: Valerie
Date: December 12, 2003 at 15:47:46 Pacific
Reply: (edit)

For a list of "Dos type" commands which may be used in NT goto http://www.ss64.com/nt/

Good luck

V...


Report Offensive Follow Up For Removal

Response Number 5
Name: name
Date: December 14, 2003 at 17:05:54 Pacific
Reply: (edit)

As usual, Weingeirieirieir has overstated the answer. If the average user can't understand that Nt/XP has "no DOS" or "no DOS prompt" then how is he/her going to concieve an "NT console"?

Maybe what we need is a forum LABELED "NT or XP DOS QUESTIONS" and then a header at the top that explains "Now that you've made it to the "XP DOS PROMPT FORUM" there really is no such.. ..........etc


Report Offensive Follow Up For Removal


Response Number 6
Name: Lucy-Jo
Date: December 15, 2003 at 03:31:36 Pacific
Reply: (edit)


Thanks for all the replies!

I couldn't care less if XP actually uses DOS or not - I did actually already know that is a 32 bit OS. You should know that XP comes with a "command prompt" that for most intents and purposes appears to respond to commands in the same way as earlier version of DOS in 16 bit Windows OS. So I _do_ program in DOS on my Windows XP machine.

Having posted the question, I had a really thorough search through the archives and eventually found the answer I needed:-

MODE COM1: baud=4800 parity=N data=8 stop=1
TYPE command > COM1
COPY COM1 text.txt

Only problem now is I can't persuade the command to stop receiving data - I have to press CONTROL-C to break it.

For my next trick I want to perform trigonometric functions with the SET command :-)

Thanks again!



Report Offensive Follow Up For Removal

Response Number 7
Name: Mick C
Date: December 15, 2003 at 04:49:15 Pacific
Reply: (edit)

Just call it NT/XP 'DOS' with a explanation at top as already suggested and place it directly under Windows XP.

Problem is you will still get a mix of 'Pure DOS' & 'XP DOS' problems posted in both. as you already do with DOS & Windows 3.1!

You cannot really win!!

Can a "suggest to move to a different forum" feature be introduced? so that moderators can move posts to the correct location??


Report Offensive Follow Up For Removal

Response Number 8
Name: x86
Date: December 15, 2003 at 09:58:35 Pacific
Reply: (edit)

Mick C, yes I would like to see that happen, whatever Lucy-jo may think, it is not DOS it is an emulation, because all cars operate on the same principal does not make them all Fords does it????? NO NO NO


I hope that we can have a NT VDM forum for NT4/W2K/XP..........


Report Offensive Follow Up For Removal

Response Number 9
Name: Wengier
Date: December 15, 2003 at 12:47:25 Pacific
Reply: (edit)

name,

PLEEEAAASE STOP SAYING THAT. NT Console batches and DOS batches are usually quite different!

For example, I don't think the following NT Console batch program will even work in real DOS:

for /f "tokens=2-4* delims=/ " %%a in ('DATE /T') do set THEDATE=%%c%%b%%a
for /f "tokens=1* delims=: " %%a in ('time /T') do set THETIME=%%aa%%bb%%cc%%dd
ren %1 %~n1%THEDATE%%THETIME%%~x1

Echo.> %~f2
For /F "tokens=*" %%A in ('Dir /B /A:-D %~f1') Do Echo @%%A>> %~f2
If %1.==. ( Echo File missing & GoTo :EOF )
If not exist %1 ( Echo File %1 not found & GoTo :EOF )
If %2.==. ( Echo String missing & GoTo :EOF )
If %3.==. ( Echo Output File missing & GoTo :EOF )
Echo Processing [%~f1]
Echo Adding [%2]
Echo Destination [%~f3]


Report Offensive Follow Up For Removal

Response Number 10
Name: tcool1970
Date: January 15, 2004 at 19:46:49 Pacific
Reply: (edit)

I have a similiar problem with Win 2000 and a dos based program that has to connect through the com 1 port. I found that you can map a com port through Win Terminal Services but I can't find Terminal Services on my 2000. I will try your fix but does anyone know anything about terminal services?


Report Offensive Follow Up For Removal

Response Number 11
Name: Passin Thru
Date: January 23, 2004 at 17:32:16 Pacific
Reply: (edit)

Lucy, I don't think that DOS is hanging, rather it is just waiting for an "End of File" control character (CTRL-z, 026 decimal, 1A hex ) to terminate the transfer and close the file. That's how it used to work in the old real DOS (the O/S as opposed to the CLI that XP gives you) days.



Report Offensive Follow Up For Removal






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home








Do you have a Desktop Computer anymore?

No
Yes, but only at work
Yes, but its rarely used
Yes, and its a workhorse


View Results

Poll Finishes Today.
Discuss in The Lounge
Poll History




Data Recovery Software