<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">The issue was that there was no path to gpg2.exe when running under Task Scheduler. And as Perl doesn't have access to the system environment variables (to the best of my limited knowledge), I wrapped the Perl script in a batch file wrapper:<div><br></div><div><font class="Apple-style-span" face="'Courier New'"><br></font><div><div><font class="Apple-style-span" face="'Courier New'">@echo off</font></div><div><font class="Apple-style-span" face="'Courier New'">set perl_bindir=C:\Perl\bin</font></div><div><font class="Apple-style-span" face="'Courier New'">set PATH=%PATH%;"C:\Program Files (x86)\GNU\GnuPG\pub"</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">%perl_bindir%\perl.exe -x -S %0</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">goto endofperl</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">#!perl</font></div></div><div><div><font class="Apple-style-span" face="'Courier New'">BEGIN {</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space:pre"> </span>use Win32 qw( SW_HIDE );</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space:pre"> </span>Win32::SetChildShowWindow( SW_HIDE );</font></div><div><font class="Apple-style-span" face="'Courier New'">}</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">use strict;</font></div><div><font class="Apple-style-span" face="'Courier New'">use warnings;</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">my $log = "decrypt.log";</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">close ( STDOUT );</font></div><div><font class="Apple-style-span" face="'Courier New'">open ( STDOUT, ">>$log" );</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">close (STDERR );</font></div><div><font class="Apple-style-span" face="'Courier New'">open (STDERR, ">>$log" );</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"># The below are commented out as I am entering them directly on the command line for troubleshooting purposes.</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"># my $data_file = "TEST_FILE.txt.pgp";</font></div><div><font class="Apple-style-span" face="'Courier New'"># my $incoming_dir = "C:<a href="smb://Users//Public//TEST//Incoming">\\Users\\Public\\TEST\\Incoming</a>";</font></div><div><font class="Apple-style-span" face="'Courier New'"># my $data = "C:<a href="smb://Users//Public//TEST//Incoming//TEST_FILE.txt.pgp">\\Users\\Public\\TEST\\Incoming\\TEST_FILE.txt.pgp</a>";</font></div><div><font class="Apple-style-span" face="'Courier New'"># my $output_file = $data_file;</font></div><div><font class="Apple-style-span" face="'Courier New'"># $output_file =~ s/\.pgp//;</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"># my $data_dir = "C:<a href="smb://Users//Public//TEST//Data">\\Users\\Public\\TEST\\Data</a>";</font></div><div><font class="Apple-style-span" face="'Courier New'"># my $output = "C:<a href="smb://Users//Public//TEST//Data//TEST_FILE.txt">\\Users\\Public\\TEST\\Data\\TEST_FILE.txt</a>";</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"># my $sec_keyring = "C:<a href="smb://Users//Administrator//AppData//Roaming//gnupg//secring.gpg">\\Users\\Administrator\\AppData\\Roaming\\gnupg\\secring.gpg</a>";</font></div><div><font class="Apple-style-span" face="'Courier New'"># my $pub_keyring = "C:<a href="smb://Users//Administrator//AppData//Roaming//gnupg//pubring.gpg">\\Users\\Administrator\\AppData\\Roaming\\gnupg\\pubring.gpg</a>";</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">system ( "gpg2.exe --batch --yes --passphrase-fd 0 --output C:<a href="smb://Users//Public//TEST//Data//TEST_FILE.txt">\\Users\\Public\\TEST\\Data\\TEST_FILE.txt</a> --no-default-keyring --keyring C:<a href="smb://Users//Administrator//AppData//Roaming//gnupg//pubring.gpg">\\Users\\Administrator\\AppData\\Roaming\\gnupg\\pubring.gpg</a> --secret-keyring C:<a href="smb://Users//Administrator//AppData//Roaming//gnupg//secring.gpg">\\Users\\Administrator\\AppData\\Roaming\\gnupg\\secring.gpg</a> --exit-on-status-write-error --decrypt C:<a href="smb://Users//Public//TEST//Incoming//TEST_FILE.txt.pgp">\\Users\\Public\\TEST\\Incoming\\TEST_FILE.txt.pgp</a> < passphrase.txt" );</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><div apple-content-edited="true">
<div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">__END__</font></div><div><font class="Apple-style-span" face="'Courier New'">:endofperl</font></div><div style="font-size: 14px; "><br></div></div><div style="font-size: 14px; ">Works fine. My regrets for the distraction...</div><div style="font-size: 14px; "><br></div><div style="font-size: 14px; ">Scott...</div><div style="font-size: 14px; "><br></div><div style="font-size: 14px; "><br></div><br class="Apple-interchange-newline">
</div>
<br></div></div>_______________________________________________<br>Gpg4win-users-en mailing list<br><a href="mailto:Gpg4win-users-en@wald.intevation.org">Gpg4win-users-en@wald.intevation.org</a><br>http://lists.wald.intevation.org/cgi-bin/mailman/listinfo/gpg4win-users-en</div></body></html>