August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!
' *** CD/DVD disc file system types Const FsiFileSystemISO9660 = 1 Const FsiFileSystemJoliet = 2 Const FsiFileSystemUDF102 = 4 WScript.Quit(Main) Function Main Dim Index ' Index to recording drive. Dim Recorder ' Recorder object Dim Path ' Directory of files to burn Dim Stream ' Data stream for burning device Index = 1 ' Second drive on the system Path = "g:\BurnDir" ' Files to transfer to disc ' Create a DiscMaster2 object to connect to optical drives. Dim g_DiscMaster Set g_DiscMaster = WScript.CreateObject("IMAPI2.MsftDiscMaster2") ' Create a DiscRecorder object for the specified burning device. Dim uniqueId set recorder = WScript.CreateObject("IMAPI2.MsftDiscRecorder2") uniqueId = g_DiscMaster.Item(index) recorder.InitializeDiscRecorder( uniqueId ) ' Create an image stream for a specified directory. Dim FSI ' Disc file system Dim Dir ' Root directory of the disc file system Dim dataWriter ' Create a new file system image and retrieve root directory Set FSI = CreateObject("IMAPI2FS.MsftFileSystemImage") Set Dir = FSI.Root 'Create the new disc format and set the recorder Set dataWriter = CreateObject ("IMAPI2.MsftDiscFormat2Data") dataWriter.recorder = Recorder dataWriter.ClientName = "IMAPIv2 TEST" FSI.ChooseImageDefaults(recorder) ' Add the directory and its contents to the file system Dir.AddTree Path, false ' Create an image from the file system Dim result Set result = FSI.CreateResultImage() Stream = result.ImageStream ' Write stream to disc using the specified recorder. WScript.Echo "Writing content to disc..." dataWriter.write(Stream) WScript.Echo "----- Finished writing content -----" Main = 0 End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.