NSIS检查磁盘空间不足
2010-07-20 12:33
651 查看
NSIS检查磁盘空间不足,转载自:http://stackoverflow.com/questions/989172/how-can-i-check-free-space-during-a-nullsoft-silent-install
备忘
The End
!include FileFunc.nsh !insertmacro DriveSpace Name "CheckFreeSpace" OutFile "C:/CheckFreeSpace.exe" InstallDir C:/tmp/checkfreespace Page instfiles Section "install_section" install_section_id Call CheckFreeSpace CreateDirectory $INSTDIR SetOutPath $INSTDIR File "C:/installme.bat" WriteUninstaller "$INSTDIR/Uninstall.exe" DetailPrint "Installation Successful." SectionEnd Section "Uninstall" RMDIR /r "$INSTDIR" SectionEnd Function CheckFreeSpace var /GLOBAL installsize var /GLOBAL adjustedinstallsize var /GLOBAL freespace var /GLOBAL instdrive ; Verify that we have sufficient space for the install ; SectionGetSize returns the size of each section in kilobyte. SectionGetSize ${install_section_id} $installsize ; Adjust the required install size by 10mb, as a minimum amount ; of free space left after installation. IntOp $adjustedinstallsize $installsize + 10240 ; Compute the drive that is the installation target; the ; ${DriveSpace} macro will not accept a path, it must be a drive. StrCpy $instdrive $INSTDIR 3 ; Compute drive space free in kilobyte ${DriveSpace} $instdrive "/D=F /S=K" $freespace DetailPrint "Determined installer needs $adjustedinstallsize kb ($installsize kb) while $freespace kb is free" IntCmp $adjustedinstallsize $freespace spaceok spaceok MessageBox MB_OK|MB_ICONSTOP "Insufficient space for installation. Please free space for installation directory $INSTDIR and try again." DetailPrint "Insufficient space for installation. Installer needs $adjustedinstallsize kb, but freespace is only $freespace kb." Abort "Insufficient space for installation." spaceok: DetailPrint "Installation target space is sufficient" FunctionEnd
备忘
The End
相关文章推荐
- 写入程序数据库 “filename”时出错;请检查是否是磁盘空间不足、路径无效或权限不够
- fatal error LNK1201:写入程序数据库“***.pdb”时出错;请检查是否是磁盘空间不足、路径无效或权限不够
- 【vs】*pdb时出错;请检查是否是磁盘空间不足、路径无效或权限不够
- 请检查是否是磁盘空间不足、路径无效或权限不够
- 错误 103 未能加载文件或程序集“Telerik.Web.UI”或它的某一个依赖项。磁盘空间不足。 (异常来自 HRESULT:0x80070070)
- 通过挂载磁盘解决SWAP分区和磁盘空间不足
- MDaemon磁盘空间不足,该怎么办
- 电脑弹出磁盘空间不足怎么办
- Mysql存储引擎MyISAM的常见问题(表损坏、无法访问、磁盘空间不足)
- undo retention Oracle 10g UNDO表空间过大导致磁盘空间不足的解决
- AndroidStudio提示磁盘空间不足
- ORA-19502 磁盘空间不足
- 磁盘空间不足导致task的mapred local文件无法写入而失败解决
- Spark 本地模式运行 磁盘空间不足
- kvm 下运行的 WINWS7磁盘空间不足 增加磁盘 实战(这个有问题,还未解决)
- vm虚拟机linux磁盘空间不足,手动扩大(转)
- 磁盘空间不足 转移ORACLE数据库数据文件的解决方案
- word2003保存文时总是提示“文档被保存,但是语音识别的数据丢失,因为没有足够的空间存储这些数据。确保没有录音时关闭麦克风,并检查磁盘上的存储空间。[转]
- 磁盘空间不足--增加虚拟磁盘
- ORACLE 目录磁盘空间不足解决方法