IMAPI界面如何选择CD扇区模式?在 Windows 10 上使用 Powershell,我需要在 IMAPI_CD_SECTOR_MODE1 中写入 CD,但我目前的方法是在 IMAPI_CD_SECTOR_MODE2FORM1 中写入 CD。
##
## Write to a CD
## Skip writing a file and write directly to the drive.
## See https://blogs.msdn.microsoft.com/opticalstorage/2010/08/13/writing-optical-discs-using-imapi-2-in-powershell/
##
Function Write-CD ($resultStream) {
Write-Verbose "Entering Write-CD driveIndex: $driveIndex"
Write-Verbose "Writing to the CD"
# initialize the recorder
$closeMediaAfterBurn = $true
$dm = New-Object -ComObject "IMAPI2.MsftDiscMaster2"
$recorder = New-Object -ComObject "IMAPI2.MsftDiscRecorder2"
$recorder.InitializeDiscRecorder($dm.Item($driveIndex))
# use formatter to burn the data:
$df2d = New-Object -ComObject IMAPI2.MsftDiscFormat2Data
$df2d.Recorder = $recorder
$df2d.ClientName = "MyScriptBurner"
$df2d.ForceMediaToBeClosed = $closeMediaAfterBurn
# burn it
$df2d.Write($resultStream)
Write-Verbose "Exiting Write-CD"
$exitCode = 0 ## Must be good if we got this far
return $exitCode
}
也可以看看...