'Avoid Line break at end of cmd output?

when I use this command pwsh -c echo hello in cmd I get the following output:

C:\>pwsh -c echo hello
hello

C:\>

I do not get that line break at the end when I run it on powershell:

PS C:\> pwsh -c echo hello
hello
PS C:\>

So I think the problem is in cmd. I know this is not such a problem and have an easy fix but I have some programs that uses cmd to access powershell and removing that line break is not that fun. So is there any fix to prevent cmd to add that line ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source