10

IfFileExists 関数を使用していますが、ジャンプ後の最初の行のみが含まれていると思います。{..../.../....} のような C に似た処理を行うにはどうすればよいでしょうか?!

IfFileExists "$PROGRAMFILES\InduSoft Web Studio v7.0\Bin\RunStartUp.exe" StartUpExists PastStartUpExists
      StartUpExists:
        StrCpy $Text "$PROGRAMFILES\InduSoft Web Studio v7.0\Bin\RunStartUp.exe"

      PastStartUpExists:
        nsDialogs::Create 1018
        Pop $Dialog

        nsDialogs::SelectFileDialog open "$PROGRAMFILES\InduSoft Web Studio v7.0\Bin\RunStartUp.exe" "*.exe"

        Pop $Text

        ${NSD_CreateText} 0 13u 100% -13u $Text
        Pop $Text

        ${NSD_CreateText} 0
        ${NSD_GetText} $Text $0

        CreateShortCut "$SMPROGRAMS\Advanlab\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
        CreateShortCut "$SMPROGRAMS\Advanlab\Uninstall.lnk" "$INSTDIR\uninst.exe"
        CreateShortCut "$SMPROGRAMS\Advanlab\Advanlab.lnk" "$0"
        CreateShortCut "$DESKTOP\Advanlab.lnk" "$0"
4

1 に答える 1

25

の構文IfFileExists

IfFileExists file_to_check offset_or_label_if_exists [offset_or_label_if_not_exists]

ブロックまたは別のブロックのいずれかを実行する場合は、2 番目のブロックを飛び越えることを忘れないでください。

したがって、単純なケースは次のようになります。

IfFileExists "$INSTDIR\file.txt" file_found file_not_found
file_found:
StrCpy $0 "the file was found"
goto end_of_test ;<== important for not continuing on the else branch
file_not_found:
StrCpy $0 "the file was NOT found"
end_of_test:

ブロックの 1 つが の直後にあるIfFileExists場合、役に立たないラベルの代わりに 0 オフセットを使用できます。

IfFileExists "$INSTDIR\file.txt" 0 file_not_found
StrCpy $0 "the file was found"
goto end_of_test ;<== important for not continuing on the else branch
file_not_found:
StrCpy $0 "the file was NOT found"
end_of_test:
于 2012-09-14T12:00:13.973 に答える