複数のコマンド ライン引数をこの形式のバッチ ファイルに渡す最も効率的な方法は何ですか?
PACKER.BAT /Action="Pack" /Source="..\path to source folder\" /Target="..\path to target folder\" /Pass="SecretCode" /Output="Packed.exe" /GPGhome="..\path to GnuPG home directory\" /User="UserID" /Admin="AdminID" /Profile="ProfileID"
.BAT では、先頭の「/」と「SET」スイッチを環境変数として削除したいと考えています。
変数は、7Zip、GPG、DWipe、およびいくつかの基本的なエラー チェックに渡されます。Vista、Win7、および Win8 で使用します。
PACKER.BAT のメモとスニペット...
:Start
:: Prepare the Command Processor & initialise variables
Set colours, title, comments, errorlevels, etc.
Read variables from general profile file, etc.
Process command line arguments
:Lock
if exist %Lock% @echo ž WARNING: %ProfileID% is running.
:Check
if exist %Action%="Pack" do ... else UnPack, etc.
if exist %Source% do ... else error
if exist %Target% do ... else create
:Zip
%7Zexe% u -ms=off -mtc=on -ssw -w%Temp% -p%Pass% -mhe=on %sfx:"=% %Target%%Output% %Source%
:GPG
%GPGexe% --homedir %GPGhome% -r %UserID% -r %AdminID% -e %Target%%Output%
:Wipe
%DWexe% wipe1 %Target%%Output%
:Help
@echo Allowable switches for %ProfileID%:
@echo %Menu:"=%
:End
:: clean up environment variables
¯¯¯¯