Skip to main content

Command line

OOSafeEraseCmd.exe erases files, folders, free space, drives and the Recycle Bin from scripts and scheduled tasks. It is installed in the program folder of O&O SafeErase when the Command line component is selected during setup; this is the default. The setup does not add it to the PATH.

Start Command Prompt or PowerShell as administrator and run it in the program folder, or call it with its full path. In PowerShell, prefix the name with .\ in its own folder. The tile Command line on the page Tools opens this page; without an internet connection, it shows the help of the command line, the same as --help.

.\OOSafeEraseCmd.exe <command> [options]
The commands erase real data

wipe-file and secure-move erase without asking. The other erase commands ask once before erasing, and --yes skips this question. Test scripts with test data first. --analyze-only only exists for the commands listed below; it is not a general test mode.

Commands​

CommandPurpose
wipe-fileErase a single file.
wipe-folderErase a folder and all its contents.
wipe-freespaceClean the free space of a volume.
wipe-diskErase an entire disk.
wipe-regionErase a partition or region of a disk.
listErase all files and folders listed in a text file.
wipe-trashSecurely empty your Recycle Bin.
list-trashList the contents of your Recycle Bin. Erases nothing.
secure-moveCopy files or folders to a target folder and then securely erase the source.
list-disksList the disks and their partitions with number, serial number and size. Erases nothing.
list-methodsList the erase methods.
verify <file>Check an erasure record (.oose or .json) or the record next to an XML report.
licenseShow, activate or check the license.

The names wipe-directory, wipe-partition, wipe-recyclebin and list-recyclebin also work.

Common options​

OptionMeaning
--method, -m <method>Erase method; see Methods. Default: Random.
--verboseDetailed output.
--quiet, -qNo progress output. Questions that need an answer are still shown.
--help, -h, /?Show the help.
--versionShow the version.

The options are checked before anything is erased. An option that does not belong to the command, an option given twice, a missing value or an unknown method ends the command with exit code 1.

Options per command​

CommandOptionMeaning
wipe-file--file, -f <path>File to erase.
wipe-folder--directory, -d <path> (or --folder, -f)Folder to erase.
list--list-file, -l <path>Text file with one path per line; lines starting with # are comments. If one line is not a valid path, nothing is erased.
wipe-file, wipe-folder, list--forceAlso erase in Windows, a program folder or a user profile; see Paths of files and folders.
wipe-folder, list--follow-linksAlso erase the targets of junctions and symbolic links. Default: only the links are removed. Mount points, network targets, drive roots, Windows, program and user profile folders are never followed.
wipe-freespace--volume, -v <path>Volume, for example C:\.
wipe-freespace--free-space, --cluster-tips, --fs-recordsOverwrite free space, cluster tips, file system records. Without any of these options, only the free space is overwritten.
wipe-disk, wipe-region--disk, -d <id>Disk number as shown by list-disks, for example 0 for \\.\PhysicalDrive0.
wipe-region--region, -r <id>Number of the partition or region as shown by list-disks.
wipe-disk, wipe-region--serial <serial number>Only erase if the disk has this serial number.
wipe-disk, wipe-region--expect-size <bytes>Only erase if the disk has exactly this size in bytes.
wipe-disk--formatAfterwards create one partition and quick-format it (internal disks: GPT/NTFS; USB drives and memory cards: exFAT, MBR up to 2 TB). Not in Fortress Mode.
wipe-disk, wipe-region--ignore-ssdDo not show the note on SSDs.
wipe-trash, list-trash--all-usersThe Recycle Bins of all users on all drives instead of your own.
list-trash--drives-onlyOnly list drives with items in the Recycle Bin.
wipe-disk, wipe-region, list, wipe-trash--analyze-onlyOnly analyze, do not erase.
wipe-folder, list, wipe-disk, wipe-region, wipe-trash--yes, -yDo not ask before erasing; see Confirmations.
secure-move--source, -s <paths>Source paths, separated by semicolons.
secure-move--target, -t <path>Target folder.

Methods​

Name for --methodPassesMethod
Random (aliases NistClear, BsiCon6)1NIST 800-88 Clear / BSI CON.6, random data. Default.
Zeros1Overwrite with zeros.
Solid1SolidErase for SSDs.
Nsa33US DoD 5220.22-M (legacy).
Bsi6Previous BSI procedure (legacy); not BSI CON.6.
Nsa77US DoD 5220.22-M ECE (legacy).
Gutmann35Gutmann method (legacy).

See Erase methods and SSDs.

License​

The command line uses the license of O&O SafeErase on this computer; it has no license of its own. Erasing requires an activated license or a trial version that has not expired; unlike the program, the command line also erases drives during the trial. During the trial, the erase commands write the days left to the error output, unless --quiet is given. license, list-disks, list-methods, verify, --help and --version work without a license.

CommandMeaning
license statusShow the license on this computer.
license activate <license key>Activate a license with its license key. Useful on a computer without the program window, for example a server.
license validateCheck the license with the O&O license service.

Paths of files and folders​

wipe-file, wipe-folder and list check every path before erasing and show the complete path that is erased:

  • A relative path such as old_data is resolved against the current folder.
  • C: alone, C:folder and \folder are refused, because they depend on a current folder that is not visible. Give the complete path, for example C:\Data\Old.
  • The root of a drive or share, for example C:\ or \\server\share, is refused. To erase a whole drive, use wipe-disk or wipe-region.
  • Windows, program folders and user profiles, and folders that contain them, are only erased with --force.

Confirmations​

Before wipe-folder, list, wipe-disk, wipe-region and wipe-trash --all-users erase anything, the command line shows what it will erase and waits for a key; Ctrl+C cancels. --yes skips this question.

A disk or partition with an operating system is only erased after the security code shown is typed at the console, as in the program. --yes does not replace the code. A disk or partition of the running Windows cannot be erased at all; erase it in Fortress Mode.

If a confirmation is required but nobody can answer, for example because the input is redirected in a scheduled task, nothing is erased and the command ends with exit code 5.

Disks and partitions​

list-disks shows each disk with its number, model, size, serial number and partitions, and marks the disk with the running Windows. For each disk, it also shows the options --serial and --expect-size with the right values.

Disk numbers can change, for example when a USB drive is connected. In scripts, add --serial and --expect-size to wipe-disk and wipe-region: if the disk under the number is a different one, nothing is erased and the command ends with exit code 1.

On an SSD, wipe-disk and wipe-region point out that overwriting does not reach the spare area of the SSD; see Erase methods and SSDs. --ignore-ssd hides this note.

Erasure records and the service​

If the O&O SafeErase service is running, the command line erases through it, the same as the program: the service checks the request, and the erasure creates a signed erasure record. At the end, the command line shows where the record is stored. Erasing through the service always requires a console started as administrator.

If the service is not running, the command line says so and erases in its own process with the rights of the console. It then creates no erasure record. Without administrator rights, it can only erase files and folders that the account may delete; disks, partitions and free space require administrator rights.

If the versions of the command line and the service do not match, for example after an incomplete update, nothing is erased and the command ends with exit code 4. Install O&O SafeErase again.

Scripts and scheduled tasks​

  • Call OOSafeEraseCmd.exe with its full path.
  • Run the scheduled task with highest privileges, so that it runs as administrator.
  • Add --yes to every command that asks; otherwise it ends with exit code 5 without erasing.
  • Identify disks with --serial and --expect-size. A disk or partition with an operating system cannot be erased from a script, because it requires the security code.
  • Evaluate the exit code instead of the text output. Notes and errors are written to the error output.
# Erase disk 3 without asking, only if it is still the same disk
$cmd = "<program folder>\OOSafeEraseCmd.exe"
& $cmd wipe-disk --disk 3 --yes --serial "4C530001230" --expect-size 64023257088
if ($LASTEXITCODE -ne 0) {
Write-Error "Erasing failed with exit code $LASTEXITCODE"
}

Examples​

# Erase a file with the default method
.\OOSafeEraseCmd.exe wipe-file --file "C:\temp\secret.txt"

# Erase a folder with the Gutmann method
.\OOSafeEraseCmd.exe wipe-folder --directory "C:\temp\old_data" --method Gutmann

# Clean the free space of C: including cluster tips
.\OOSafeEraseCmd.exe wipe-freespace --volume "C:\" --free-space --cluster-tips

# Show the disks with number, serial number and size
.\OOSafeEraseCmd.exe list-disks

# Erase disk 2 (a USB stick) and format it afterwards
.\OOSafeEraseCmd.exe wipe-disk --disk 2 --format

# Erase partition 1 on disk 2
.\OOSafeEraseCmd.exe wipe-region --disk 2 --region 1

# Erase all paths listed in a file, without asking
.\OOSafeEraseCmd.exe list --list-file "C:\scripts\files_to_delete.txt" --yes

# Securely empty your Recycle Bin
.\OOSafeEraseCmd.exe wipe-trash

# Activate a license
.\OOSafeEraseCmd.exe license activate <license key>

# Check an erasure record
.\OOSafeEraseCmd.exe verify "C:\Reports\Report_20261019_083000.oose"

Exit codes​

CodeMeaning
0Success. For verify: the record is valid, also without a timestamp.
1Wrong use: invalid, unknown or repeated option, file or target not found, refused path, or a disk that does not match --serial or --expect-size. Nothing was erased.
2No valid license: not activated, trial expired or no longer valid.
3The operation failed.
4The versions of the command line and the service do not match.
5A confirmation is required, but the input is redirected. Nothing was erased.
6Completed, but not every item was overwritten: only a link or a hard link name was removed, or a cloud placeholder was deleted. The items are listed.
7Prohibited by a policy of your administrator (wipe-disk, wipe-freespace).
20verify: the record was changed.
21verify: gap in the record chain.
22verify: unsigned record, or legacy report without a record.
99Unexpected error.
130Cancelled, for example with Ctrl+C or a wrong security code.

Commands of oosecmd​

Earlier versions of O&O SafeErase came with the command line oosecmd.exe. OOSafeEraseCmd.exe does not accept its parameters. Adapt existing scripts as follows:

oosecmdOOSafeEraseCmd.exe
Files and folders without a parameter, --matchwipe-file --file <path>, wipe-folder --directory <path>; several paths: list --list-file <file>
--security <level>--method <method>: highest → Gutmann, high → Nsa7, medium → Bsi, low → Nsa3, lowest → Random, zero → Zeros
--freespace <drive>wipe-freespace --volume <drive>:\
--deletedrive <number>wipe-disk --disk <number>
--deletevolume <drive letter>wipe-region --disk <number> --region <number>; list-disks shows the numbers
--showdisks, -wlist-disks
--tempfiles recyclebinwipe-trash
--tempfiles, --internetfilesNo command; erase browser and Windows traces in the program
--analyse, --autocleanNo command
--register "user:… company:… serial:…"license activate <license key>
--createreport, -r, --reportnameNo option; an erasure record is created when the service is running; see Erasure records and the service
--yes, -y--yes, -y
--silent, -s--quiet, -q
--verbose, -v--verbose; -v now stands for --volume

Browser and Windows traces can only be erased in the program; see Erase browser and Windows traces.