检测D盘是否存在,否则获取最大硬盘分区

!include "MUI2.nsh"
!include "FileFunc.nsh"
OutFile "查找磁盘分区.exe"
Name "查找磁盘分区"

!include MUI2.nsh
!insertmacro MUI_LANGUAGE "SimpChinese"

Section
 ;检查某个分区可用空间
 StrCpy $9 "E:\"
 ${DriveSpace} $9 "/D=F /S=M" $R3
 ${If} $R3 = null
 ;查找所有硬盘驱动器(HDD)
 ${GetDrives} "HDD" "FindHDD"
 MessageBox MB_OK "$R2可用空间最大"
 ${Else}
 StrCpy $R6 $9 1
 MessageBox MB_OK "您要检查的$R6:\存在"
 ${EndIf}
SectionEnd

Function "FindHDD"
 ;获取查找到的驱动器盘符($9)可用空间(/D=F)单位兆(/S=M)
 ${DriveSpace} $9 "/D=F /S=M" $R0
 ${If} $R0 > $R1
 StrCpy $R1 $R0
 StrCpy $R2 $9
 ${EndIf}
 Push $0
FunctionEnd
THE END
喜欢就支持一下吧
点赞11 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容