1.

Solve : .bat file association?

Answer»

Hey everybody, this is a general question about .bat files that has never come up before for me.

I have an encryption program set up at work that uses the .pgp encryption format. I open these by using a .bat file to de-encrypt them that has instructions and links to my encryption keys. I recently UPGRADED my workstation from an XP system to a Win7 system. I used to be able to double click the .pgp file and the dycryption program would run automatically (in fact there are still XP computers on the network that continue to work this way). On my windows 7 system this no longer works. I tried setting the association of .pgp files to the .bat file I use, but it will just not accept it as a default program for opening. I can still drag and drop the encrypted files into the .bat and it runs LIKE normal which indicates to me that the .bat is fine and working correctly. It's not a huge hassel but i just found it odd that i can no longer do it the old way. Could this just be a win7 quirk or am I not seeing something?

Thanks for any help!
Edgecrusher22Post the .bat file...ok here is the .bat I **** out the password for our system and mel and alice are just server names at this location. I don't see anything wrong and like I said it works fine if you drop the encrypted files into it. I just can't get it to associate with the incoming encrypted files for double-click opening purposes seems more like a windows issue rather than a .bat issue.

@echo off
setlocal ENABLEDELAYEDEXPANSION
REM This File is used by scheduled tasks and should not be deleted!!!
REM
REM Usage: decrypt.bat (output file) (input file)
REM Example: decrypt.bat final.pgp final.txt
REM This example shows how to encrypt a file called final.txt
REM and create a final output file named final.pgp.
REM This SCRIPT assumes that the password is **********.
echo %date% %time% Decryption of %2 to %1 >> \\mel\GPG\scripts\log.txt
echo *******************************
echo BEGINNING DECRYPTION OF FILE
echo *******************************
Set var1=**********

path \\alice\dfs\cygwin\bin;%path%

if .%2==. (
set infile=%~1
set outfile=!infile:.pgp=!
set outfile=!outfile:.gpg=!
) ELSE (
set infile=%~2
set outfile=%~1
)
echo infile= %infile%
echo outfile=%outfile%

echo %var1%|\\mel\gpg\gpg --homedir=\\mel\gpg --batch --yes --passphrase-fd 0 -o "%outfile%" --decrypt "%infile%"

rem Inspect file to see if it's a tar file.
file "%outfile%" |grep -q "POSIX tar archive"
if errorlevel 1 goto :NotTar
echo *******************************
echo Decrypted file is a TAR archive; expanding ..
echo *******************************
echo on
pushd "%outfile%\.."
tar -xvf "%outfile%" --force-local && del "%outfile%"
popd
pause

:NotTar
echo *******************************
echo FILE DECRYPTION COMPLETE...
echo *******************************

endlocal



Discussion

No Comment Found