Command: Freedisk
function: Check for a specified amount of free disk space before continuing to run the next program.
Syntax: freedisk [/s Computer [/u [domain\]user [/P [Password]]] [/D Drive] [Value]
Parameters: "/d Drive" Specifies the drive to query for disk space availability; "Value" checks for a specified amount of free disk space, which can be in bytes, KB, MB, GB, TB, and so on.
For unattended installations, you can use the Freedisk command in a batch file installation to check for available disk space before continuing the installation.
When you use the Freedisk command in a batch file, if there is enough space, the command returns 0, otherwise it returns 1. We can use this return value to control the running of the following program.
① assume that we want to determine whether there is at least 5GB of free space on drive C, and then enter "Freedisk/d C:5GB" at the command prompt to verify that the free space is sufficient.
② using this command, we can add the space check function for the software we designed. Assume that the design of the Software Master execution program, the program name is Mysoftware.exe, the default installation on D disk, the need for space 500MB. Now open Notepad,
Enter the following:
FREEDISK/D D:500MB
If not errorlevel 1 goto install
The echo the space is not enough to install this software
Goto END
: Install
Start MySoftware
Goto END
: End
Then click program → Save As, select All files after save type, enter "X.bat" after "File name" (X represents any file name, such as we can set to Setup.bat), so a batch file named X.bat is built. Run (double click) What effect does it have? If the rest of the D disk is more than 500MB, the installer will automatically run, otherwise the "the" is not enough to install this software, the installer automatically quits.