Burning CDs with the IMAPI2 Control
(Page 1 of 4 )
With the release of Windows XP and later, the Windows operating system gained a built-in CD burning feature. The Microsoft Image Mastering API (IMAPI) was created to provide programmers with a method of creating disc images and to provide access to Windows’ CD burning feature.There are currently two versions of the IMAPI control. The original version shipped with Windows XP and Windows Server 2003. Its successor, IMAPI2, shipped with Windows Vista and Windows Server 2008. Unfortunately, version 1 of the control does not provide adequate scripting access. Not to worry though; you can install the
IMAPI2 update on older systems.
We’re going to take a look at burning single-session data discs from a directory of files. This means that once the disc is written, no other writing will be possible. This script is also going to assume that the device is ready and that it contains blank media. There are several ways to check these things from within your script; however, that is far beyond the scope of this article.
To begin, you’ll need a directory of files to burn. This directory may contain subfolders if you wish. We’re going to burn the entire directory tree. This is convenient if you wish to write a script that will burn CDs for backup purposes.
The IMAPI control can be used to write disc images to other storage devices as well.
Finally, this script will also assume that you know which drive you need to use on your system. Since the drive will need to have blank media in it, I thought it rather foolish to spend time creating a script to auto-detect a drive.
The drive will be identified by number on your system. I’ll show you a small script that will display your drive information so that you can correctly identify which drive you need to be using.
Next: Identifying a Supporting Device >>
More Windows Scripting Articles
More By Nilpo