BAT批處理文件
比較有意思的地方是:
setlocal enabledelayedexpansion 變量延遲和!變量!的使用。同樣的方式可以讀入文本文件中不同行的內容來賦值變量
@echo off
:: todo
setlocal enabledelayedexpansion
set /a j=0
for /f "tokens=1-3 delims=" %%i in (ps.txt) do (
set /a j+=1
rem set /a j+=1
rem echo !j!
rem echo %%i
if !j!==1 set ps=%%i
)
rem echo %ps%
rem echo %txt%
set inputfile=%1%
echo -----------------------------------------------------------
echo Decrypt the pgp file from WideVine portal - %inputfile%
echo -----------------------------------------------------------
echo;
set outputfile=%inputfile:~0,-28%xml
rem echo Output file - %outputfile%
gpg --passphrase %ps% --decrypt %inputfile% > %outputfile%
echo -----------------------------------------------------------
echo Decrypt the pgp file successfully.
echo Encrypt the %outputfile% with customer key
echo -----------------------------------------------------------
echo;
gpg -r widevine_keys -e %outputfile%
BAT批處理文件