Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Redirect the output outside the output file

I have a batch which call another batch file. Lets call them b1 and b2. Here is the code inside my 2 batch files.

b1 :

@echo off

call b2.cmd 1>output.txt

and b2 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

@echo off

echo "I want this in output.txt"
echo "I want this in the cmd window" 1>&1

After executing my script I got :

output.txt :

"I want this in output.txt"

and in the command line :

The handle couldn't be duplicated during the redirection of the handle 1.

(which is : "Le handle n’a pas pu être dupliqué lors de la redirection du handle 1." in french, (and sry for the bad traduction))

And I want to have :

output.txt :

"I want this in output.txt"

and in the command line :

"I want this in the cmd window"

Do someone have any idea to make this output ?

If you need any details, ask me and I will try to help you.

PS : I can have more than 1 intermediate file (like b1 call b2, b2 call b3, etc) and I still want to print something from the last file.

>Solution :

echo "I want this in the cmd window" 1>con

worked for me.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading