我正在尝试制作一个安装脚本:
C:\windows\system32上的应用C:\Windows\System32中的C:\Windows\System32和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位pc上,它将两个文件(tapi_64bits.tsp和tapi_32bits.tsp)都放在Syswow64文件夹中。安装程序确实说它安装在正确的文件夹中,但这两个文件都位于Syswow64文件夹中。我做错了什么?
发布于 2012-05-25 20:06:02
NSIS是一个32位的应用程序,因此受到文件重定向的影响。
您必须使用x64.nsh,它有检测WOW64和禁用重定向的代码(尽快将其打开)。另一种选择是提取到$windir\sysnative,但这更像是一种黑客行为,在XP 64上不起作用。
发布于 2014-04-01 17:09:17
下面的代码应该可以工作。
!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}
SectionEndhttps://stackoverflow.com/questions/10755338
复制相似问题