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

How do I pass two 'echo n' responses to the same command in a batch file

I need to run the following batch file and pass "N" twice. I can figure out how to pass it once, but twice I just can’t figure out:

@ECHO OFF

Regedt32 /s registrychanges.reg
echo n | gpupdate /force /sync
shutdown /r /f /t 0

The gpupdate /force /sync requires "N" twice. Even if I do echo n | echo n | gpupdate /force /sync it just hangs at the prompt for the second n.

Is there actually a way to pass two echo responses in a batch file for the same command?

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

Thanks!

>Solution :

Create a code block and pipe to the command.

(
echo n
echo n
)|gpupdate /force /sync
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