Subject: Re: bug#71081: 30.0.50; shell-command-on-region outputs boilerplate text on Windows

From: Eli Zaretskii <[email-masked]>
Date: Thu, 23 May 2024 16:37:55 +0300

> From: Ihor Radchenko <[email-masked]>
> Cc: [email-masked], [email-masked], [email-masked]
> Date: Thu, 23 May 2024 12:06:25 +0000
> 
> Then, what about something like
> 
> (shell-command-to-string "echo foo\necho bar")
> 
> On Linux, it yields
> "foo
> bar"
> 
> On Windows, it yields
> 
> "foo"

Yes, because the Windows shell doesn't support command lines with
embedded newlines, so it ignores everything past the first newline.
(Actually, there are complicated tricks to do that, but I'll spare
you.)

Instead, you should do this on Windows:

  (shell-command-to-string "echo foo && echo bar")

This is the documented method of invoking cmd.exe with multiple
commands.