FAQ: Scripting & Batch mode

How to erase hard drive? Windows7 logo   How to erase hard drive? Intel logo

Frequently Asked Questions (FAQ)

Scripting & Batch mode


How can I have killdisk boot from a boot disk and erase all drives except the USB stick it booted from?

In most cases you can write a small batch file to launch killdisk with the parameter to erase all drives (-ea) as well as the 'exclude removable drives' parameter (-xr).

However, some removable disks report themselves as being fixed disks and this command will not work on those specific drives. They will be erased along with the other drives.

If you include these 2 files when making the boot disk (using the startup scripts tab) the computer will boot and run killdisk with the command line parameters to erase all drives (-ea) and exclude the USB stick (-xd=…).

As soon as the computer boots in bootdisk, these 2 files will determine the physical disk to exclude and launch the program with these parameters. It does not matter if the USB stick reports itself as removable or fixed if you use these files.


The 2 files are just a batch file to copy the exe to the program files folder and run it to get the physical drive that bootdisk booted from. The batch file uses that information to launch killdisk with the erase all drives parameter and exclude the 1 drive we booted from. It also sets the log and certificate file folders to the USB image.


Download (64-bit)

Download (32-bit)


How can I set bootable CD/USB in BIOS?

To boot from a CD, DVD or USB device, make sure that the device has the boot sequence priority over the hard drive.

BIOS (Basic Input Output Subsystem) is a programmable chip that controls how information is passed to various devices in the computer system. A typical method to access the BIOS settings screen is to press ESC, F1, F2, F8 or F10 during the boot sequence.

BIOS settings allow you to run a boot sequence from a floppy drive, a hard drive, a CD-ROM drive or an external device. You may configure the order that your computer searches these physical devices for the boot sequence. The first device in the order list has the first boot priority. For example, to boot from a CD-ROM drive instead of a hard drive, place the CD-ROM drive ahead of the hard drive in priority.

While you are in the BIOS Setup Utility, you will not be able to use your mouse. Use the keyboard arrow keys to move around the screen.

Before you set boot priority for a USB device, plug the device into a USB port.

To specify the boot sequence:

  1. Start the computer and press ESC, F1, F2, F8 or F10 during the initial startup screen. Depending on the BIOS manufacturer, a menu may appear.
  2. Choose to enter BIOS setup. The BIOS setup utility page appears.
  3. Use the arrow keys to select the BOOT tab. System devices appear in order of priority.
  4. To give a CD or DVD drive boot sequence priority over the hard drive, move it to the first position in the list.
  5. To give a USB device boot sequence priority over the hard drive, do the following:
    1. Move the hard drive device to the top of the boot sequence list.
    2. Expand the hard drive device to display all hard drives.
    3. Move the USB device to the top of the list of hard drives.
  6. Save and exit the BIOS setup utility.
  7. The computer will restart with the changed settings.
Picture. Boot Priority Options.
Boot Priority Options

Some computer manufacturers allow you to select the device that contains the boot sequence from a special device selection menu. The example below uses a Dell system board.

To set boot priority using a device selection menu:

  1. When the computer starts to boot up, after the manufacturer's ID screen, press F12 several times. The device selection menu appears.
  2. Use the up and down arrows to select CD-ROM.
  3. To boot from the selected device, press ENTER.

Using an incorrect BIOS setting can cause a system malfunction. Please follow the BIOS guide provided with your computer motherboard. If you read these instructions and you are not sure how to change a setting, it is better to leave it as the default setting.

  Saving Active@ KillDisk Logs and Reports to bootable USB disk New!

Read more

When running cmd scripts (batch files) from bootdisk we run into a significant problem.

We do not know what folder the batch file is running from.
If you include the batch file when you create the bootdisk (user scripts) or double click it from bootdisk explorer, the system never lets on that it knows where the batch file is running from.

That makes it difficult to auto run programs you included, or set parameters for log / cert files if you want them stored on the boot USB.

This can be avoided if you include this line as the first line of the batch file.

cd /d %~dp0

this changes the directory to the folder the batch file is running from.

the %~dp0 part breaks down as follows
the % and 0 is the batch file
%~d0 is the name of the drive the batch file is running from
%~p0 is the name of the folder the batch file is running from
%~dp0 is the drive\path the batch file is running from

So, for instance, to run KillDisk and set the log path and certificate path to something on the boot USB you can do the following.

This is an exact batch file I used (nothing changed) that worked to boot bootdisk, run KillDisk and set the cert / log folders, erase a drive, and shutdown the system saving the log and certificate in the desired folders.

cd /d %~dp0
set dr=%~d0
set kdlog=%dr%\kd\log
set kdcert=%dr%\kd\cert
set kdini=%dr%\kd\ini
IF NOT EXIST %kdlog%\NUL md %kdlog%
IF NOT EXIST %kdcert%\NUL md %kdcert%
IF NOT EXIST %kdini%\NUL md %kdini%
cd "x:\program files\bootdisk"
start killdisk -em=0 eh=80h -cp=%kdcert% -lp=%kdlog% -sd -ip=%kdini%
IF NOT EXIST %kdini%\killdisk.ini copy x:killdisk.ini  %kdini%
cd /d %~dp0

Here is a line by line description if we want to give it to customers or make available online.

Change folder to the folder the batch is running out of:

cd /d %~dp0

Make up a variable to represent the drive letter and store the drive letter in it. The can be used whenever the boot media drive letter is needed:

set dr=%~d0

Make and set variables to store the name of the folders you want to store logs, certificates and settings in:

set kdlog=%dr%\kd\log
set kdcert=%dr%\kd\cert
set kdini=%dr%\kd\ini

If those folders do not exist on the boot media, create them:

IF NOT EXIST %kdlog%\NUL md %kdlog%
IF NOT EXIST %kdcert%\NUL md %kdcert%
IF NOT EXIST %kdini%\NUL md %kdini%
rem run killdisk with the desired (created) parameters
cd "x:\program files\bootdisk"
start KillDisk.exe -em=0 eh=80h -cp=%kdcert% -lp=%kdlog% -sd -ip=%kdini%
IF NOT EXIST %kdini%\killdisk.ini copy x:killdisk.ini  %kdini%
cd /d %~dp0

In the above batch, exe was launched using start.

The batch file continues after launching KillDisk (does not wait for or know about KillDisk ending so do not use 'start' if you want a return variable form the program you are running. After execution current settings are stored locally to be used the next time killdisk runs.


New! Automating Erasure with Active@ KillDisk

Read more

Automating Erasure with Active@ KillDisk. Tips and suggestions

Read more


Are there any best practices for using Active@ KillDisk to erase large arrays of hard drives?

Hard Drives may be erased individually in a JBOD configuration, however, it is more optimal to configure the array of disks using either a RAID0+1 or a RAID 10 configuration as depicted below.

killdisk and arge arrays of hard drives   killdisk and arge arrays of hard drives


When using scripting and the KillDisk settings file, 'killdisk.exe -ip="D:\user_files" ' becomes invalid if there are more than one drive\volume attached to the system. The reference to D: is now assigned to another drive\volume. How can this be resolved?

Edit your script file to include the following lines...

FOR %%i IN (c d e f g h i j k l m n o p q r s t u v w x y z) 
DO IF EXIST %%i:\user_files\KILLDISK.INI ( SET CDROM=%%i: GOTO END ) :END killdisk -ip="%CDROM%\user_files"

With that in place, no matter what drive letter the CD gets assigned, this script will seek for the drive letter that contains "\user_files\KILLDISK.INI".


I think I have a virus on my computer. Is formatting enough to get rid of all traces of it or is there some way to make sure all data is completely erased from the drive?

Formatting alone is not enough. You should back up all data you need saved then use a data destruction program (killdisk is one) to overwrite all sectors on the disk. Then re-install the OS and copy your data back to the drive.


I am donating my computer to a charity. They will re-install the operating system on it but I need to make sure all my personal data is deleted before I ship it out. Is it enough to format the drive or is there something else I should do?

Any data recovery can retrieve your data after formatting. Although the charity probably won't go looking for old data, you have no idea what other uses will do. The charity might just turn around and sell it and there are people who buy computers just to see if they can get old data from them. You should definitely wipe the drive. Use a program designed to make data unrecoverable. Killdisk in one of them.


My company has requested that I prepare several machines to be de-commissioned and I need to make sure all data is off these machines. My boss asked me to wipe the drives but when I asked him how he could not give me a clear answer. Does anyone know of a simple way to 'wipe a drive'?

If the machines are being de-commissioned it is imperative that the data be securely wiped form the drive. There are software tools designed to do exactly that. Killdisk is a tool that will overwrite every sector on the drive several times to ensure even the best data recovery labs could not restore a single file from the computer.You can even prepare a script for bootable disk that can sanitize a machine automatically, after you insert CD or USB and turn off the PC.


We need to completely erase all data from a raid set including the raid striping information.. What is the best way to do this?

You should use a software like killdisk. The striping information is stored on sectors on the disk, and since Killdisk erases all sectors, it will erase those sectors as well.


Does KillDisk support command line arguments?

Yes, it does. You can place line into for example autoexec.bat to destroy all HDD (Hard Disk Drive) found. See help for the details.


What types of HDD it understands?

All types of HDD are supported. KillDisk will clean it up properly if hard disk drive or USB disk is visible in BIOS, or accessible under Windows environment (device drivers properly installed).


Will I be able to use my HDD after Active@ KillDisk erase operation?

To be able to use HDD again you need to:

  • repartition HDD using a standard utility like FDISK
  • reformat hard drive using a standard utility like FORMAT
  • reinstall an Operating System using bootable CD-ROM or USB / floppy if you wish to boot from the hard drive


Why can killdisk (or hard drive monitor) not return serial numbers from drives hooked up to RAID controllers?

The software uses standard SCSI/ATI function calls (through Windows or DOS) to get serial numbers from hard drives.

Most, if not all, RAID controllers do not properly process these requests.

Typically, a RAID controller is used to hook up 2 or more hard drives in such a way that the operating system thinks it is one drive. Therefore, the operating system can not access the drives individually. When queried for a hard drive's serial number, the RAID controller does not know which serial number to return, so it does not return a serial number at all. All RAID controllers tested will do this even if there is only one drive in the RAID set.


How many operating systems supported by KillDisk?

KillDisk is a DOS program and it does not matter which operating system is installed on the machine. If you can boot in DOS mode (from boot diskette for example), you can erase any drives independently of Operating System installed. The only requirement is that machine be a standard PC (Intel-architecture, not PPC, not ARM, not MIPS).


Does KillDisk run on any computer?

KillDisk runs on any PC-compatible machine, which is based on Intel architecture. It does not run on MIPS, ARM, PPC processors, for example it won't run on Sun SPARC systems or iPad & Android tablets.



How to add computer's Serial/ServiceTag/Asset number into the PDF certificate? (KillDisk 10 or earlier)

Here are a few steps to accomplish this:

Read more


Can I add the computer's Serial/ServiceTag/Asset number to the KillDisk log or certificate? (KillDisk 10 or earlier)

You may add the following lines to your script after the KillDisk command:

Read more

This document is available in PDF format, which requires Adobe® Acrobat® Reader
(Free download):

Size: 714 KB

USER'S GUIDE (Console)
Size: 683 KB

KillDisk Datasheet
Size: 2,44 MB

Data Recovery

Data Utility

Data Security

Data Backup

CD/DVD Tools