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]
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
| Command | Purpose |
|---|---|
wipe-file | Erase a single file. |
wipe-folder | Erase a folder and all its contents. |
wipe-freespace | Clean the free space of a volume. |
wipe-disk | Erase an entire disk. |
wipe-region | Erase a partition or region of a disk. |
list | Erase all files and folders listed in a text file. |
wipe-trash | Securely empty your Recycle Bin. |
list-trash | List the contents of your Recycle Bin. Erases nothing. |
secure-move | Copy files or folders to a target folder and then securely erase the source. |
list-disks | List the disks and their partitions with number, serial number and size. Erases nothing. |
list-methods | List the erase methods. |
verify <file> | Check an erasure record (.oose or .json) or the record next to an XML report. |
license | Show, activate or check the license. |
The names wipe-directory, wipe-partition, wipe-recyclebin and list-recyclebin also work.
Common options
| Option | Meaning |
|---|---|
--method, -m <method> | Erase method; see Methods. Default: Random. |
--verbose | Detailed output. |
--quiet, -q | No progress output. Questions that need an answer are still shown. |
--help, -h, /? | Show the help. |
--version | Show 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
| Command | Option | Meaning |
|---|---|---|
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 | --force | Also erase in Windows, a program folder or a user profile; see Paths of files and folders. |
wipe-folder, list | --follow-links | Also 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-records | Overwrite 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 | --format | Afterwards 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-ssd | Do not show the note on SSDs. |
wipe-trash, list-trash | --all-users | The Recycle Bins of all users on all drives instead of your own. |
list-trash | --drives-only | Only list drives with items in the Recycle Bin. |
wipe-disk, wipe-region, list, wipe-trash | --analyze-only | Only analyze, do not erase. |
wipe-folder, list, wipe-disk, wipe-region, wipe-trash | --yes, -y | Do 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 --method | Passes | Method |
|---|---|---|
Random (aliases NistClear, BsiCon6) | 1 | NIST 800-88 Clear / BSI CON.6, random data. Default. |
Zeros | 1 | Overwrite with zeros. |
Solid | 1 | SolidErase for SSDs. |
Nsa3 | 3 | US DoD 5220.22-M (legacy). |
Bsi | 6 | Previous BSI procedure (legacy); not BSI CON.6. |
Nsa7 | 7 | US DoD 5220.22-M ECE (legacy). |
Gutmann | 35 | Gutmann method (legacy). |
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.
| Command | Meaning |
|---|---|
license status | Show 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 validate | Check 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_datais resolved against the current folder. C:alone,C:folderand\folderare refused, because they depend on a current folder that is not visible. Give the complete path, for exampleC:\Data\Old.- The root of a drive or share, for example
C:\or\\server\share, is refused. To erase a whole drive, usewipe-diskorwipe-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.exewith its full path. - Run the scheduled task with highest privileges, so that it runs as administrator.
- Add
--yesto every command that asks; otherwise it ends with exit code 5 without erasing. - Identify disks with
--serialand--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
| Code | Meaning |
|---|---|
| 0 | Success. For verify: the record is valid, also without a timestamp. |
| 1 | Wrong 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. |
| 2 | No valid license: not activated, trial expired or no longer valid. |
| 3 | The operation failed. |
| 4 | The versions of the command line and the service do not match. |
| 5 | A confirmation is required, but the input is redirected. Nothing was erased. |
| 6 | Completed, 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. |
| 7 | Prohibited by a policy of your administrator (wipe-disk, wipe-freespace). |
| 20 | verify: the record was changed. |
| 21 | verify: gap in the record chain. |
| 22 | verify: unsigned record, or legacy report without a record. |
| 99 | Unexpected error. |
| 130 | Cancelled, 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:
oosecmd | OOSafeEraseCmd.exe |
|---|---|
Files and folders without a parameter, --match | wipe-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, -w | list-disks |
--tempfiles recyclebin | wipe-trash |
--tempfiles, --internetfiles | No command; erase browser and Windows traces in the program |
--analyse, --autoclean | No command |
--register "user:… company:… serial:…" | license activate <license key> |
--createreport, -r, --reportname | No 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.