Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nsis 如何使安装程序检查文件夹安装是否无效?_Nsis - Fatal编程技术网

Nsis 如何使安装程序检查文件夹安装是否无效?

Nsis 如何使安装程序检查文件夹安装是否无效?,nsis,Nsis,。实际上,我在同一台计算机上安装了不同版本的软件,因此,当用户继续进行第三个版本的安装时,我希望检查文件夹中的两个版本。我正在尝试使用循环,但安装程序不工作。提前感谢 我已经在同一台计算机上安装了同一软件的两个版本。我希望在安装第三个版本时,脚本应检查路径,并且不允许用户在已安装前两个版本的路径中安装 Function .onVerifyInstDir nsArray::Set array 1.6 nsArray::Set array 1.7 nsArray::Set arr

。实际上,我在同一台计算机上安装了不同版本的软件,因此,当用户继续进行第三个版本的安装时,我希望检查文件夹中的两个版本。我正在尝试使用循环,但安装程序不工作。提前感谢

我已经在同一台计算机上安装了同一软件的两个版本。我希望在安装第三个版本时,脚本应检查路径,并且不允许用户在已安装前两个版本的路径中安装

Function .onVerifyInstDir




  nsArray::Set array 1.6
  nsArray::Set array 1.7
  nsArray::Set array 1.8



  nsArray::Length array
  Pop $R0
  ;DetailPrint `array length: $R0`

  StrCpy $R1 0
  ${DoWhile} $R1 < $R0
    nsArray::Get array $R1
    Pop $R2
    StrCpy $tempregistry "$(^Name)_$R2"

    ;DetailPrint `MyArray2[$R1] is $R2`



 ReadRegStr $path  HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstal\$tempregistry""InstallLocation"  ;fetching installed location

   ${If} $path == ""


   ${Else}
   strCmp $path $INSTDIR 0 pathGood
   ;Abort
    IntOp $R1 $R1 + 1
   ${EndIf}  
  ${Loop}


    PathGood:
  FunctionEnd
Function.onVerifyInstDir
nsArray::设置数组1.6
nsArray::设置阵列1.7
nsArray::设置数组1.8
nsArray::长度数组
流行音乐$R0
;DetailPrint`数组长度:$R0`
StrCpy$r10
${DoWhile}$R1<$R0
nsArray::获取数组$R1
流行音乐$R2
StrCpy$tempregistry“$(^Name)\$R2”
;DetailPrint`MyArray2[$R1]是$R2`
ReadRegStr$path HKLM“软件\Microsoft\Windows\CurrentVersion\Uninstall\$tempregistry”“安装位置”;获取安装位置
${If}$path==“”
${Else}
strCmp$path$INSTDIR 0 pathGood
;中止
输入$R1$R1+1
${EndIf}
${Loop}
帕斯古德:
功能端
以下是步骤

  • 将您的产品名称或注册表项存储在变量中
  • 将要安装的路径存储在变量中,例如$path
  • 在循环内检查注册表项

    ReadRegStr$pdt HKLM“软件\Microsoft\Windows\CurrentVersion\Uninstall\productname

  • 如果找到,检索安装位置的值并将其存储在变量中; 例如$path1 ReadRegStr$path1$pdt“安装位置” 否则继续

  • ${if}$path==$path1 messagebox mb_ok“路径中已安装另一个版本”

  • ${else} 进行
  • ${endif}

  • 你能试着解释一下你正在尝试做什么,并发布你目前拥有的代码吗?现在我已经添加了我的问题的细节,你能帮我吗