get return code from plink?

Nate picture Nate · Nov 3, 2010 · Viewed 12.8k times · Source

In a DOS batch script, I'm running a single command on a remote (also windows) computer using plink. Formerly, this command was only run on the local machine, and was relying on the return code to determine success. Is there a way to easily get this information back through plink?

Answer

Frédéric Hamidi picture Frédéric Hamidi · Nov 3, 2010

That's not possible with plink. The current consensus is to have the remote script echo its exit code to a log file, then use pscp to transfer the log file to the local machine.

See http://fixunix.com/ssh/74235-errorlevel-capturing-plink.html.