Hello everyone, this is my first post in this site, I'm having problems running pscp.exe from a cgi-script. I have seen some threads about running exes from cgi-script but I haven't found a "standard" solution for it. I have a html form where the user inputs the values, then I form a pscp command with those parameters, like always, the formed command works ok from the command prompt but not from the browser, if I left the T parameter in the script I got: "Insecure dependency in system while running with -T switch at..."; if I remove that switch the page just stays on "Waiting for localhost..." until it times out. I'm using the Apache web server, trying to copy the file to my computer, could this be a running cmd.exe issue? and if it is, how can I get around it?
#!/perl/bin/perl -wT use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; $ENV{'PATH'} = 'C:\\Temp\\'; #Declare the variables my $result; my $staging_area = param('staging'); my $directory = param('directory'); my $user_id = param('userid'); my $passwd = param('passwd'); my $store = param('store'); #Attach the store directory to the diectory variable $directory = $directory . "/" . $store; #Set the directory where pscp.exe resides my $pscp_dir = 'C:\\Temp\\'; #Construct the pscp command with the right arguments my $command = $pscp_dir . "pscp.exe -batch -pw " . $passwd . " " . $us +er_id . "@" . $staging_area . ":" . $directory . "/" . $store . "*.tg +z " . $pscp_dir; #Execute the command system($command); if ( $? == -1 ) { $result = "command failed: $!\n"; } print header; print start_html("Thank You"); print h2("Thank You"); print "$command<br>\n"; print "$result<br>\n"; print end_html;

In reply to Running pscp from cgi-script in Windows by redrafiki

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.