脚本:计算最大剩余空间的分区

优质
小牛编辑
123浏览
2023-12-01
引用脚本的内容:

name "最大剩余空间"
OutFile "maxfreespace.exe"
!include LogicLib.nsh

!include "FileFunc.nsh"
!insertmacro GetDrives
!insertmacro DriveSpace

Section ""
  
SectionEnd

Var myno1
;Var myno2
Var Drivelabel

Function .onInit

 ${DriveSpace} "C:\" "/D=F /S=M" $R0
 StrCpy $myno1 $R0 ;初始化临时变量
 ${GetDrives} "HDD+FDD" "GetDrives_L"
MessageBox MB_OK "最大剩余空间的是盘符$Drivelabel , 空间 $myno1 MB"
FunctionEnd
 
 
Function GetDrives_L
${DriveSpace} "$9" "/D=F /S=M" $R0
Push $0

IntCmp $myno1 0 done done +1
IntCmp $R0 $myno1 +1 +3 +1
StrCpy $Drivelabel $9
StrCpy $myno1 $R0
done:
FunctionEnd