Tom's Hardware > Forum > Applications > Programming > Clarification in DOS
Word :    Username :           
 

Hi,
can any one help me in finding out how to chat using dos , not between two PCs, but between two command prompt windows in the same Pc.

Sponsored Links
Register or log in to remove.

The command prompts in Windows (and most OS's) are isolated instances of a command interpreter that is 'DOS like'.

They do not support inter-process communication as far as I am aware.

However: If they each take turns polling the same file (with reads ideally), assuming they can both see the same volume, folder, file (ie: C:\DATA\test.dat), then yes it would be possible.

You'd want to code something up that checks the file, and outputs something to it, say using ECHO "Test data 1" >> C:\DATA\test.dat, and then have it also check for the existence of that line in the file, in which case it knows it's the '2nd instance', or 'nth' instance.

The easiest way from there would be to just have each one read/append the file, ideally on opposite 10 second blocks of time.

ie: If time is 0-9 seconds, it's turn 1, and if it's 10-19, it's turn 2, and so on.

Of course if you are that good at coding a partial exe solution for a batch file you may as well code the whole solution in C/C++/C# or Java.

Then just have the batch file call your new EXE with parameters.

======

ECHO "Test to append here" >> C:\DATA\test.dat

and

TYPE C:\DATA\test.dat [which prints it to the screen]

would be a good starting point however.

Read about ECHO, >, and >> internal commands/operators in DOS.

------------------------------ Averaging 7 points per post, since err, I re-joined this mess.
Reply to Scott2009
Tom's Hardware > Forum > Applications > Programming > Clarification in DOS
Go to:

There are 962 identified and unidentified users. To see the list of identified users, Click here.

Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them