Give ssh a better chance of working on Windows.
Switch the type of quotes used for the remote command.
Open the pipe in binary mode.
#!/bin/sh
hg init
echo "Is there an error message when trying to diff non-existing files?"
hg diff not found
echo "Is there an error message when trying to add non-existing files?"
hg add not found