SETLOCAL enableextensions enabledelayedexpansion
:: change your Given/First name
set MYSELF=Felipe
set BOSS=Jon
set "MYFILE=Timesheet_%MYSELF%_FY10.11_Version_1.1.xls"
set "MYLOCKEDFILE=%MYFILE%.gpg"
set "SAFETY=~%MYFILE%"
:: PFx86: this variable is needed to avoid breaking 'if' statement below
set "PFx86=%PROGRAMFILES(x86)%"
if exist (%PFx86%) (
set "GPGBIN=%PFx86%\GNU\GnuPG\"
echo 64-bit windows...
) else (
set "GPGBIN=%PROGRAMFILES%\GNU\GnuPG\"
echo 32-bit windows...
)
if exist %MYLOCKEDFILE% (
echo locked file found
for %%F in (%MYLOCKEDFILE%) do (
set ATTRIBS=%%~aF
set READ_ATTRIB=!ATTRIBS:~1,1!
if !READ_ATTRIB!==r (
echo locked file is RO...
:: svn lock
TortoiseProc.exe /command:lock /path:%MYLOCKEDFILE%
) else (
echo locked file is RW...
)
:: decrypt
echo decrypting...
"%GPGBIN%\gpg.exe" "%MYLOCKEDFILE%"
)
if exist %MYFILE% (
echo opening %MYFILE%...
%MYFILE%
echo encrypting...
:: encrypt
gpg.exe -r %BOSS% -r %MYSELF% -e %MYFILE%
echo deleting %MYFILE%...
del %MYFILE%
)
)
I have a batch file that does the following
- decrypts a timesheet.xls.gpg file
-
opens it with
“timesheet.xls”
-
then encrypts it again with gpg
When the timesheet gets opened, it immediately continues to the ‘encrypt’ phase.
How can I make it wait until the XLS file is closed to resume the running of the script (without explicit user intervention)?
I used
And it worked.