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");


In reply to Re: system() and backticks not working by Roger
in thread system() and backticks not working by Jobby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.