Start several scripts at once but still have output

Viewed 33

I'm trying to run several scripts at once and have them output to different files but I can't get my code to work.

Code:

@echo off
start "" EXECUTIONSCRIPT1 >> "DIRECTORY\run1.log"
start "" EXECUTIONSCRIPT2 >> "DIRECTORY\run2.log"
start "" EXECUTIONSCRIPT3 >> "DIRECTORY\run3.log"

The scripts themselves perform whatever they need to do just fine, however, I can't get them to output anything to their files even though it's specified in the code.

If I remove (start "") they all run one after the other and they all output to their log files but that defeats the whole purpose of having them all run at the same time.

1 Answers

Right now, the >> is taking the output of the start command. In order for the >s to get passed as an argument instead of being activated immediately, they need to be escaped.

@echo off
start "" EXECUTIONSCRIPT1 ^>^> "DIRECTORY\run1.log"
start "" EXECUTIONSCRIPT2 ^>^> "DIRECTORY\run2.log"
start "" EXECUTIONSCRIPT3 ^>^> "DIRECTORY\run3.log"
Related