Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having a batch file which runs two parallel processes. We want to log these two processes into two separate text files.
Process is getting called using bat file and same is getting log using this bat file.

But this process only creating the log files but not logging anything into the files.
Please let me know if you have any solution, I have given the similar code for your reference.

batch file reference code:-

start ping Testdb1> C:\Users\log\Test1.txt
start ping Testdb2 > C:\Users\log\Test2.txt


What I have tried:

It's logging when we are making it sequential and also when i split the bat files into separate files and then try calling it from master one then also it's working.
Any help would be appriciated
Posted
Updated 25-Jul-16 4:51am
v2

Those commands will redirect the output of the start command to the text file. while the ping starts a new process with no redirection. You should create a new batch file that performs the ping and redirects the output. Something like:
// myping.bat
ping %1 > %2
 
Share this answer
 
The alternative (but not recommended) approach would be:
start cmd.exe /C ^(ping Testdb1 ^> C:\Users\log\Test1.txt^)
start cmd.exe /C ^(ping Testdb2 ^> C:\Users\log\Test2.txt^)

Found here: Batch files - How To ... Display and Redirect Output[^]
 
Share this answer
 
Comments
BIPUL RANJAN 25-Jul-16 14:53pm    
Thanks it has worked :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900