1. 程式人生 > >NSIS 獲取最大容量碟符

NSIS 獲取最大容量碟符

!include "FileFunc.nsh"
!include "LogicLib.nsh"

OutFile "Demo.exe"
SilentInstall silent

Section
;查詢所有硬碟驅動器(HDD)
${GetDrives} "HDD" "FindHDD"
MessageBox MB_OK "最大可用空間驅動器碟符:$R2"
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