[Gpg4win-users-en] Help with ActivePerl and Task Scheduler - SOLVED

Scott Stansbury sstansbury at aol.com
Mon Apr 23 21:55:07 CEST 2012


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:


@echo off
set perl_bindir=C:\Perl\bin
set PATH=%PATH%;"C:\Program Files (x86)\GNU\GnuPG\pub"

%perl_bindir%\perl.exe -x -S %0

goto endofperl

#!perl
BEGIN {
	use Win32 qw( SW_HIDE );
	Win32::SetChildShowWindow( SW_HIDE );
}

use strict;
use warnings;

my $log = "decrypt.log";

close ( STDOUT );
open ( STDOUT, ">>$log" );

close (STDERR );
open (STDERR, ">>$log" );

# The below are commented out as I am entering them directly on the command line for troubleshooting purposes.

# my $data_file = "TEST_FILE.txt.pgp";
# my $incoming_dir = "C:\\Users\\Public\\TEST\\Incoming";
# my $data = "C:\\Users\\Public\\TEST\\Incoming\\TEST_FILE.txt.pgp";
# my $output_file = $data_file;
# $output_file =~ s/\.pgp//;

# my $data_dir = "C:\\Users\\Public\\TEST\\Data";
# my $output = "C:\\Users\\Public\\TEST\\Data\\TEST_FILE.txt";

# my $sec_keyring = "C:\\Users\\Administrator\\AppData\\Roaming\\gnupg\\secring.gpg";
# my $pub_keyring = "C:\\Users\\Administrator\\AppData\\Roaming\\gnupg\\pubring.gpg";

system ( "gpg2.exe --batch --yes --passphrase-fd 0 --output C:\\Users\\Public\\TEST\\Data\\TEST_FILE.txt --no-default-keyring --keyring C:\\Users\\Administrator\\AppData\\Roaming\\gnupg\\pubring.gpg --secret-keyring  C:\\Users\\Administrator\\AppData\\Roaming\\gnupg\\secring.gpg --exit-on-status-write-error --decrypt C:\\Users\\Public\\TEST\\Incoming\\TEST_FILE.txt.pgp < passphrase.txt" );


__END__
:endofperl

Works fine. My regrets for the distraction...

Scott...




_______________________________________________
Gpg4win-users-en mailing list
Gpg4win-users-en at wald.intevation.org
http://lists.wald.intevation.org/cgi-bin/mailman/listinfo/gpg4win-users-en
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wald.intevation.org/pipermail/gpg4win-users-en/attachments/20120423/59bf7058/attachment.html>


More information about the Gpg4win-users-en mailing list