Dos

Asked • 05/24/19

Redirect DOS Output Only if there is Output?

I have a series of lines in a batch file (.bat) running on a Windows machine, e.g.: start /b prog.exe cmdparam1 cmdparam2 > test1.txt start /b prog.exe cmdparam1 cmdparam2 > test2.txtSometimes proj.exe returns nothing (empty) instead of useful data. In those cases I want to not generate a text file, is this something easily doable on the batch file side of things? The current behavior is that a text file is always created, in the case of empty output it's just a blank file.

1 Expert Answer

By:

Patrick B. answered • 05/24/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.