Skip to content

Run commands for various shells

Yanbing edited this page Jan 14, 2019 · 4 revisions

Here are examples to run commands on remote shell over openssh. Examples are to print out "hello" remotely.

DefaultShell cmd on local shell cmd to print on remote shell (client cmd run in cmd prompt)
powershell echo '"hello"'
or echo `"hello`"
c:\>ssh.exe localhost echo '\"hello\"'
or c:\>ssh.exe winbox echo `\"hello`\"
or c:\>ssh.exe localhost "echo `""hello`"""
bash echo \"hello\"
or echo '"hello"'
c:\>ssh winbox 'echo \"hello\"'
or c:\>ssh.exe winbox echo \\\"hello\\\"
or c:\>ssh winbox echo '\"hello\"'
cygwin echo \"hello\"
or echo '"hello"'
c:\>ssh winbox 'echo \"hello\"'
or c:\>ssh.exe winbox echo \\\"hello\\\"
or c:\>ssh winbox echo '\"hello\"'
cmd.exe echo "hello" c:\>ssh.exe winbox echo \"hello\"
or c:\>ssh.exe winbox "echo ""hello"""
ssh-shellhost.exe to be added to be added

If you have a shell other than above and want it to receive exactly the same argument list that the ssh received on the server side, Please refer to DefaultShell for setting DefaultShell and set DefaultShellEscapeArguments to 0.

Clone this wiki locally