NSIS是个十分好用的打包工具,工作中常用到AutoCAD软件,出于某些原因,我需要使用NSIS来获取AutoCAD的安装路径。
经过对注册表的一番查看,写出代码如下:
#可自行扩展,比如需要安装AutoCAD字体时,需要找到AutoCAD的安装路径等 Page instfiles ShowInstDetails show Var regCount Var subCount Var regKeyName Var subKeyName Var acadLocation Section SetRegView 64 StrCpy $regCount 0 StrCpy $subCount 0 loop: EnumRegKey $regKeyName HKEY_LOCAL_MACHINE SOFTWARE\Autodesk\AutoCAD $regCount IntOp $regCount $regCount + 1 StrCmp $regKeyName "" done loop_sub: EnumRegKey $subKeyName HKEY_LOCAL_MACHINE SOFTWARE\Autodesk\AutoCAD\$regKeyName $subCount IntOp $subCount $subCount + 1 StrCmp $subKeyName "" loop ReadRegStr $acadLocation HKEY_LOCAL_MACHINE SOFTWARE\Autodesk\AutoCAD\$regKeyName\$subKeyName "Location" StrCmp $acadLocation "" loop_sub done: DetailPrint $acadLocation SectionEnd
时间: 2024-11-05 22:40:46