これはあまりエレガントではないかもしれませんが、「ProgramFiles(x86)」のディレクトリ「C:\ PROGRA〜2 \ JASPER〜1.0 \ buildomatic」が存在するかどうか、および「C:\ PROGRA〜1 \ JASPER〜1.0」が存在するかどうかを確認できます。 「プログラムファイル」の「\buildomatic」。次に、個別の分岐を実行し、そこでのニーズに応じてすべてを処理できます。
ここでその方法を見つけます:
http://nsis.sourceforge.net/IfFileExists_Changes_Section_Flags
これがお役に立てば幸いです。
編集:あなたはこのようなものを試してみたいかもしれません(警告はテストされていません):
Section /o "Program Files(x86)" prg2
SetOutPath "C:\PROGRA~2\JASPER~1.0\buildomatic"
File /r "C:\Users\Desktop\K-installer\backup3101"
File "C:\Users\Desktop\K-installer\batch\demo.bat"
ExecWait '"C:\PROGRA~2\JASPER~1.0\buildomatic\demo.bat"'
SectionEnd
Section /o "Program Files)" prg1
SetOutPath "C:\PROGRA~1\JASPER~1.0\buildomatic"
File /r "C:\Users\Desktop\K-installer\backup3101"
File "C:\Users\Desktop\K-installer\batch\demo.bat"
ExecWait '"C:\PROGRA~1\JASPER~1.0\buildomatic\demo.bat"'
SectionEnd
Function .onInit
IfFileExists C:\PROGRA~1\JASPER~1.0\buildomatic Prog1Exists PastProg1Exists
Prog1Exists:
; Use the macro from sections.nsh
!insertmacro SelectSection ${prg1}
PastProg1Exists:
IfFileExists C:\PROGRA~2\JASPER~1.0\buildomatic Prog2Exists PastProg2Exists
Prog2Exists:
; Use the macro declared above
!insertmacro SelectSection ${prg2}
PastProg2Exists:
FunctionEnd