[英]NSIS script not installing in correct directory
我正在嘗試制作安裝腳本:
C:\\windows\\system32
C:\\Windows\\System32
tapi_64bits.tsp 和C:\\Windows\\SysWOW64
tapi_32bits.tsp這是我寫的腳本:
; The name of the installer
Name "TAPI Installer"
; The file to write
OutFile "TAPI Installer"
; The default installation directory
InstallDir $DESKTOP
;--------------------------------
; Install to the correct directory on 32 bit or 64 bit machines
Section
IfFileExists $WINDIR\SYSWOW64\*.* Is64bit Is32bit
Is32bit:
; Set output path to the installation directory.
SetOutPath $SYSDIR
; Put file there
File tapi_32bits.tsp
; SectionEnd MessageBox MB_OK "32 bit"
SetRegView 32
StrCpy $INSTDIR "$PROGRAMFILES32\LANDesk\Health Check"
GOTO End32Bitvs64BitCheck
Is64bit:
; install in C:\Windows\System32
SetOutPath $WINDIR\System32\
; file to put there
File tapi_64bits.tsp
; install in C:\Windows\SysWOW64
SetOutPath $WINDIR\SysWOW64
; file to put there
File tapi_32bits.tsp
;SectionEnd MessageBox MB_OK "32 bit"
SetRegView 32
StrCpy $INSTDIR "$PROGRAMFILES32\LANDesk\Health Check"
GOTO End32Bitvs64BitCheck
MessageBox MB_OK "64 bit"
SetRegView 64
StrCpy $INSTDIR "$PROGRAMFILES64\LANDesk\Health Check"
End32Bitvs64BitCheck:
SectionEnd
;--------------------------------
但是在 64 位電腦上,它會將兩個文件(tapi_64bits.tsp 和 tapi_32bits.tsp)放在 Syswow64 文件夾中。 安裝程序確實說它安裝在正確的文件夾中,但兩個文件都在 Syswow64 文件夾中。 我究竟做錯了什么?
以下代碼應該可以工作。
!include x64.nsh
; Install to the correct directory on 32 bit or 64 bit machines
Section
${If} ${RunningX64}
; install in C:\Windows\System32
SetOutPath $WINDIR\System32\
; file to put there
File tapi_64bits.tsp
; install in C:\Windows\SysWOW64
SetOutPath $WINDIR\SysWOW64
; file to put there
File tapi_32bits.tsp
${Else}
; Set output path to the installation directory.
SetOutPath $SYSDIR
; Put file there
File tapi_32bits.tsp
${EndIf}
SectionEnd
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.