2012-10-22 18 views

回答

1

NSIS有一個section屬性可以幫助你做到這一點:AddSize

如果你真的需要一個變量量必須使用系統插件:

System::Call 'kernel32::GetDiskFreeSpaceEx(t"$instdir",*l.r1,*l,*l)' 
DetailPrint $1 

,或者如果你需要的Win9x/NT4支持:

!include LogicLib.nsh 

Function GetDiskFree 
Exch $0 
Push $1 
System::Call 'kernel32::GetDiskFreeSpaceEx(tr0,*l0s,*l,*l)i.r1' 
${If} $1 < 1 
    Exch $2 ;Throw away result from Ex 
    System::Call 'kernel32::SetCurrentDirectory(tr0)' 
    System::Call 'kernel32::GetDiskFreeSpace(i0,*i0r1,*i0r0,*i0r2,*i)' 
    System::Call 'kernel32::SetCurrentDirectory(to)' 
    IntOp $1 $1 * $0 
    System::Int64Op $1 * $2 
    Exch 
    Pop $2 
${EndIf} 
Exch 2 
Pop $0 
Pop $1 
FunctionEnd 


Section 
Push $instdir 
Call GetDiskFree 
Pop $0 
System::Int64Op $0/1024 ;to kb 
Pop $1 
DetailPrint "$1 KiB ($0)" 
SectionEnd 
+0

安德斯,謝謝您cooperatipon ..你真棒! – Prakash

相關問題