LoginSignup
1
0

More than 3 years have passed since last update.

ImgBurn をコマンドラインで操作する。

Last updated at Posted at 2020-06-14

ImgBurn とは

ImgBurn は、 CD / DVD / HD DVD / Blu-ray を焼くための Windows 用ツールです。実際のメディアには焼かなくても、ISO ファイルを作って複数ファイルを一纏めにするだけでも便利です。
公式サイトはこちら

(1) コマンドライン・オプションの調べ方

(a) ImgBurn.exe と同じフォルダーにある ReadMe.txt を参照する。こちらの方が詳しい。

(b) コマンドラインで ImgBurn /? と実行する。

※ ImgBurn.exe は %ProgramFiles(x86)%\ImgBurn\ または %ProgramFiles%\ImgBurn\ に存在。

(2) 留意点

(a) 一部のコマンドライン・オプションの値は、ダブルクォーテーションで括る。

cmd.exe
・正
ImgBurn.exe /VOLUMELABEL "HOGE"

・誤
ImgBurn.exe /VOLUMELABEL HOGE
PowerShell
・正(PowerShell の例)
Start-Process -FilePath "C:\Program Files (x86)\ImgBurn\ImgBurn.exe" -ArgumentList @("/VOLUMELABEL" "`"HOGE`"") -Wait
# 勿論、ImgBurn に渡すオプションはこれだけでは足りません。

(b) エラー・スキップが出来ていない。

ファイル・パスが深すぎる(フォルダ1\フォルダー2\…\フォルダーn\foo.txt とか)際にその旨を知らせるダイアログが出て動作が止まる。
今のところ回避方法(エラー時は進行をそこで止めて終了。)は不明。

(3) PowerShell でのサンプル

・D:\WorkSpace\ 以下に、焼きたいファイル(フォルダーを含む)がフォルダー単位で纏められている。
 ※例: D:\WorkSpace\FOO\ 、D:\WorkSpace\BAR\、D:\WorkSpace\HOGE\

・D:\ISO\ に .ISO ファイルを出力する。
・.ISO ファイルのラベルは、FOO、BAR、HOGE など、D:\WorkSpace\ 直下のフォルダー名が用いられる。
・.ISO のルートには、D:\WorkSpace\FOO\ 直下にあるファイル・フォルダーが置かれる。(BAR、HOGE も同様。)

PowerShell
# 自分の環境に合わせて書き換える。
$cmd = "C:\Program Files (x86)\ImgBurn\ImgBurn.exe"
$SrcRootDir = "D:\WorkSpace"
$DestRootDir = "D:\ISO"


$Dirs = @(Get-ChildItem $SrcRootDir -Directory)
foreach($Dir in $Dirs)
{
    $arguments =  @(
    "/MODE"
    "BUILD"

    "/BUILDMODE"
    "IMAGEFILE"

    "/FILESYSTEM"
    "`"ISO9660 + UDF`""

    "/UDFREVISION"
    "`"1.02`"" 

    "/ROOTFOLDER"
    "NO"

    "/NOIMAGEDETAILS"

    "/CLOSE"

    "/START"
    )

    $tmpDirs = @(Get-ChildItem $Dir.FullName -Directory).FullName
    $currentSrcDir = $tmpDirs -join "|"

    $currentDstIsoFilename = "{0}.ISO" -F $Dir.Name
    $currentDstIsoFilename = Join-Path $DestRootDir $currentDstIsoFilename
    $currentLabel = $Dir.Name

    Write-host $currentSrcDir
    write-host $currentDstIsoFilename
    write-host $currentLabel
    write-host ""

    $arguments += "/SRC"
    $arguments += ("`"{0}`"" -F $currentSrcDir)

    $arguments += "/DEST"
    $arguments += ("`"{0}`"" -F $currentDstIsoFilename)
    $arguments += "/VOLUMELABEL"
    $arguments += ("`"{0}`"" -F $currentLabel)

    Start-Process -FilePath $cmd -ArgumentList $arguments -Wait
}

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0