私はWiX Toolsetを使用してインストーラを作成しています。チェックボックスをオンにして古い構成(.config拡張子のファイル)をバックアップし、新しいファイルをインストールする場合は、_newに名前を追加します。インストーラのカスタムアクションとしてCmdが動作しない
これを達成するためのcmdスクリプトを作成し、カスタムアクションに挿入しました。 (ログに応じて)実行中
<CustomAction Id="RenameNewConfigs" Directory="INSTALLFOLDER" ExeCommand='for /r %%a in (*.config) do ren "%%~a" "%%~na_new%%~xa"' Impersonate="no" Execute="deferred" Return="ignore" />
<CustomAction Id="MoveOldConfigs" Directory="INSTALLFOLDER" ExeCommand='xcopy /SYI "..\OldConfigs" "."' Impersonate="no" Execute="deferred" Return="ignore" />
<CustomAction Id="RemoveConfigsBackup" Directory="INSTALLFOLDER" ExeCommand='rd ..\OldConfigs /S /Q' Impersonate="no" Execute="deferred" Return="ignore" />
<InstallExecuteSequence>
<Custom Action="RenameNewConfigs" After="InstallFiles">KEEP_OLD_CONFIGURATION</Custom>
<Custom Action="MoveOldConfigs" After="RenameNewConfigs">KEEP_OLD_CONFIGURATION</Custom>
<Custom Action="RemoveConfigsBackup" After="MoveOldConfigs">INSTALLED AND (NOT REMOVE="ALL")</Custom>
</InstallExecuteSequence>
第一および第三のコマンドは次のような出力を生成:
Info 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: RenameNewConfigs, location: C:\Program Files\correct\path\, command: for /r %%a in (*.config) do ren "%%~a" "%%~na_new%%~xa"
間違っていますか?標準コマンドを実行できないのはなぜですか?
1は非常に同じタスクを実行するためのWiX機能で構築されており、C++/C#を(使用して使用することをお勧め:)動作するはずです)カスタムアクション。 –