Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to save the text using >  (Read 3103 times)

0 Members and 1 Guest are viewing this topic.

integrator

  • Guest
How to save the text using >
« on: November 22, 2007, 08:44:13 PM »
Hello,

I'm trying to write a program which will launch a .exe from CMD, and using the > command capture the text. The only problme I have is after awhile the text file will become very large. I need to figure out how to save the file after a while without stopping and start the .exe again

Thanks for any help

gpl



    Apprentice
  • Thanked: 27
    Re: How to save the text using >
    « Reply #1 on: November 23, 2007, 02:45:47 AM »
    This is not possible (probably, Im sure someone will come up with a smart way of doing it!!)

    However - if you are not interested in the contents of the file, just redirect the output to the device NUL (>NUL) which just loses the output.

    If you are only interested in some of the output, filter it with FindStr
    mycommand.exe|findstr 'parameters'> mytext.txt

    'parameters' is obviously replaced by your conditions for selecting lines

    Graham


    vibhor_agarwalin



      Adviser

      Re: How to save the text using >
      « Reply #2 on: November 23, 2007, 06:14:13 AM »
      May be you could create 2 files:

      One for standard outpur >
      Other for error 2>
      Vibhor Kumar Agarwal

      Carbon Dudeoxide

      • Global Moderator

      • Mastermind
      • Thanked: 169
        • Yes
        • Yes
        • Yes
      • Certifications: List
      • Experience: Guru
      • OS: Mac OS
      Re: How to save the text using >
      « Reply #3 on: November 23, 2007, 06:55:02 AM »
      Not entirely sure this will work but try it:

      Start "' "C:\path\to\file.exe" >> "%userprofile%\desktop\log.txt"