Hello
I need some help creating a batch file...
I've an application that recieve data on COM1 and then create a txt file with the message recieved on COM1.
The application is then waiting for this txt file to be deleted before creating the next message (data is buffered inside the application).
I found this file watcher utility http://sourceforge.net/projects/fwutilities/?source=dlp and this utility can handle commands when ever a file is generated.
What I need is a command that will:
1. Read the text from the text file (message from COM1)
2. Append this text to an output.txt file
2a. Text should be added in a newline on each insert(append).
3. Only continue if text has been written to output.txt
4. Delete text file (COM1)
I have tried this:
TYPE c:\input.txt >> c:\output.txt
but I need help on how to make newline in output.txt and also how to secure that the insert has been handled before deleting the input file.
thank you
Append and delete bacth file needed
Moderator: DosItHelp
Re: Append and delete bacth file needed
This should monitor for the file, check every 10 seconds roughly, and append the text to the output file, and then add a newline and delete the input file.
Code: Select all
@echo off
:loop
if exist "c:\input.txt" (
echo found input file - processing...
TYPE "c:\input.txt" >> "c:\output.txt"
echo. >> "c:\output.txt"
del "c:\input.txt"
echo processing complete
echo.
)
ping -n 10 localhost >nul
goto :loop
Re: Append and delete bacth file needed
thank you foxidrive.
This did what I asked for...
but, the application will not read the output fil.
Is there anyway that this could be sent to at tcp port on localhost instead of been written to the output file?
thx
This did what I asked for...
but, the application will not read the output fil.
Is there anyway that this could be sent to at tcp port on localhost instead of been written to the output file?
thx
Re: Append and delete bacth file needed
tisbris wrote:Is there anyway that this could be sent to at tcp port on localhost instead of been written to the output file?
Do you want the file uploaded to a HTTP server?
Re: Append and delete bacth file needed
I need the raw text from the input file to be sent to an applikation (not http).
The only konfiguration i got inside this application is this:
[Channel 4]
Name=963
Host=127.0.0.1
Type=Visonik
Port=9999
This application is already recieving data from other systems directly - meaning without this input file. But this new system can only deliver text files.
The data form the old system can be seen on a telnet term - if that helps.
PS. We do not have the source code of this application
thx
The only konfiguration i got inside this application is this:
[Channel 4]
Name=963
Host=127.0.0.1
Type=Visonik
Port=9999
This application is already recieving data from other systems directly - meaning without this input file. But this new system can only deliver text files.
The data form the old system can be seen on a telnet term - if that helps.
PS. We do not have the source code of this application

thx
Re: Append and delete bacth file needed
You might need to use a scriptable telnet to serve the data to the application, but that's a guess as we don't have access to test it.
There is a tool called TST which can be scripted - you can google on these details for it.
Telnet Scripting Tool v.1.0
by Albert Yale
There is a tool called TST which can be scripted - you can google on these details for it.
Telnet Scripting Tool v.1.0
by Albert Yale