2017-06-05 37 views
1

ファイル名をzipに変更する必要がありますが、このコードを試しても動作しません。Inno Setupでファイルの名前を変更するにはどうしたらいいですか?

Exec('cmd.exe', 'rename '+ExpandConstant('{app}\scripts\set.bat'+' set.zip'), '', SW_SHOW, 
     ewWaitUntilTerminated, ResultCode); 

私は[Run]セクションでそれを行う方法を見つけましたが、私はそれが[Code]セクションで行う必要があります。

+2

でrenameFile()http://www.jrsoftware.org/ishelp/index.php?topic = isxfunc_renamefile –

答えて

2
  1. あなたは{app}は通常、スペース(Program Files)が含まれていて、パスを引用する必要があります。

  2. コマンドの前に/Cコマンドラインパラメータが必要です。 @Alexが正しくコメントとしてけれども

Exec('cmd.exe', 
    '/C rename ' + AddQuotes(ExpandConstant('{app}\scripts\set.bat')) + ' set.zip', 
    '', SW_SHOW, ewWaitUntilTerminated, ResultCode); 

、代わりにRenameFileを使用します。

RenameFile(ExpandConstant('{app}\scripts\set.bat'), ExpandConstant('{app}\scripts\set.zip')); 
+0

私のエラーが見つかりました:RenameFile(ExpandConstant( '{app} \ scripts \ unset.bat')、 'unset.zip'); ' –

関連する問題