savestat.cmd

The savestat.cmd utility allows you to store and retrieve up to 21 values to persistent storage.

You can use the savestat utility to return to your place in an installation, even when a reboot is required. This utility is designed to return values that set the errorlevel environment variable so that you can branch in a script or batch file based on the result of the utility's execution.

The utility runs in 32- and 64bit versions of Windows Preinstallation Environment 2.1/3.0, Windows Server 2003, and Windows Server 2008.

Because savestat.cmd uses the persistent storage capability of ASU, the following files must be available for the script to work:

savestat usage

The savestat utility command-line syntax:

SAVESTAT [/q] /reset
SAVESTAT [/q] /set1=value [.../set2=value ... /set21=value]
SAVESTAT [/q] /getn
SAVESTAT [/q] /validate
SAVESTAT [/q] /signature

The savestat utility uses these parameters.

Table 1. savestat parameters
Parameter Description Usage
/setn=value
Saves an integer value, value, to the th location in persistent-storage memory, where n is an integer from 121
Return codes:
  • 0 if successful
  • 1 if not successful
savestat /setn=value
Where:
  • n is an integer from 121
  • value is an integer from 0254
/getn
Retrieves the value currently set in the nth location in persistent-storage memory, where n is an integer from 1-21.
Return codes:
  • The value stored at the location specified by n, if successful.
  • 255 if not successful.
savestat /getn

Where n is an integer from 121

/reset
Resets all persistent-storage memory to values of zero.
Return codes:
  • 0 if successful
  • 1 if not successful
savestat /reset
/signature
Verifies that the persistent storage contains the savestat signature.
Return codes:
  • 0 if storage contains the signature
  • 1 if storage does not contain the signature
savestat /signature
/validate
Verifies that the system is supported by savestat.
Return codes:
  • 0 if the system is supported
  • 1 if the system is not supported
savestat /validate
/q
Invokes the quiet mode. This parameter is optional and can be used with any other savestat parameter.
savestat /q /set1=100

savestat examples

The following examples illustrate savestat utility usage.
Example Description
savestat /set2=100
Stores the value 100 in the second persistent-storage memory location
savestat /get2

if errorlevel 100 goto end
if errorlevel 1 goto level1

:level1
call level1.bat

:end
Retrieves the value of the second persistent-storage memory location and branches in the batch file according to the value returned