Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Outputting batch file results to a single file instead of new lines

Options
  • 15-06-2018 6:06pm
    #1
    Closed Accounts Posts: 5,756 ✭✭✭


    Hi,
    I have a small piece of software that was developed by someone else , It is for performance monitoring purposes for a specific supplication.

    When I run it using the specified arguments it requires , its results are output line by line.

    I set up a batch file that will run the .exe with the correct arguments , and then out put the results to a log file, and that works great.

    What I would like to achieve is to have the results printed to the log file on one line each time the batch file is run.

    Here is the batch script currently:


    @echo off

    >>C:�\Test_SimTX\test.txt (

    echo [%date% %time%]

    "C:\data\test.exe"
    Echo Done!
    )


    The results will be output like this (this is when run 3 times in a row):

    [15/06/2018 17:20:10.10]
    Connecting to Server.
    Sending Message to Server.
    Waiting for Response.
    Response: OK - Took: 1.325983
    Done!
    [15/06/2018 17:31:04.20]
    Connecting to Server.
    Sending Message to Server.
    Waiting for Response.
    Response: OK - Took: 1.0607864
    Done!
    [15/06/2018 17:32:06.31]
    Connecting to Server.
    Sending Message to Server.
    Waiting for Response.
    Response: OK - Took: 1.37
    Done!

    This is fine, but I would like to make each write to the log display as below:

    [15/06/2018 17:32:06.31] Connecting to Server. Sending Message to Server. Waiting for Response. Response: OK - Took: 1.37 Done!


    Anyone have any ideas?

    I found something after a few mins of google to try using set /p , but it has not worked in any way, I might be using it incorrectly.


Advertisement