What's strange is that this worked a month ago and doesn't work anymore
Did you make any changes to the system in the last month?
If I take the command and run in a command window, everything is OK
Just a wild guess, perhaps you have installed some program that has changed your windows profile or something like that, so that the secure copy
pscp can not pick up your private key any more? Or perhaps your PATH has been modified in the last month so your script can not pick up the pscp.exe program any more?
I've tried running the command using backticks too, but nothing happens there either
That would not help because your problem is most likely related to
scp settings.
The script is run silently at regular intervals using a cron replacement for windows and wperl.exe
Did you include some debugging/logging facility in your script? Do you have a log file?
The following are a few suggestions for tracing the problem:
1) check the return result of system command
system("pscp ....") or {
open $log, ">C:\pscp.log";
print $log "Can not execute the pscp command.";
close $log;
exit(1);
}
2) add -v (verbose) option to your pscp command to print more info.
redirect output of your pscp command to a log file.
system("pscp .... -v >> c:\pscp.log 2>&1");