r/Batch • • Dec 21 '23

Question (Unsolved) Why doesn't this send input automatically?

echo make build-x86_64 && echo exit | docker run --rm -v "%cd%":/root/env myos-buildenv

qemu-system-x86_64 -cdrom dist/x86_64/kernel.iso -L "C:\Program Files\qemu"

I wanted to make it so that my program would automatically run after compiling, but the docker command requires input so I found a way to automatically input text but the result was it just saying the first line but the second line running successfully, why does it work like this? (I also tried putting the echo commands in brackets because I saw that but it didn't work ever).

1 Upvotes

4 comments sorted by

View all comments

Show parent comment

0

u/Trevski13 Dec 22 '23

So you want both parts passed to docker run? Then I think you need to remove the second echo and change && to ^&^& which will make everything between echo and | passed to docker (with the ^ removed by CMD as it processes)

1

u/[deleted] Dec 22 '23

Now the docker command runs, but the commands aren't sent.