LoginSignup
5
5

More than 3 years have passed since last update.

Office 2019オフラインインストール用batファイル

Last updated at Posted at 2019-12-03

ボリュームライセンスでOffice Standard 2019を購入し、オフラインでインストールを行う方法です。
インストールは、32ビット版、64ビット版の両方を対象としています。
Office 2019オフラインインストール用batファイル(32ビット版のみ)
Office 2019オフラインインストール用batファイル(64ビット版のみ)

インストールファイルのダウンロード

  1. VLSCからOffice Standard 2019のダウンロードでOffice 2019 Deployment Toolのexeをダウンロードする。

  2. ダウンロードしたexeを実行し、展開先に適当なフォルダ(C:\Office2019)を指定する。
    展開先のフォルダにはsetup.exeとサンプルのxmlがある。

  3. 展開先のフォルダに次の2つのファイルを作成する。

    configuration-x86.xml
    <Configuration>
      <Add SourcePath="C:\Office2019\Download_x86" OfficeClientEdition="32" Channel="PerpetualVL2019">
        <Product ID="Standard2019Volume">
          <Language ID="ja-jp" />
        </Product>
      </Add>
    </Configuration>
    
    configuration-x64.xml
    <Configuration>
      <Add SourcePath="C:\Office2019\Download_x64" OfficeClientEdition="64" Channel="PerpetualVL2019">
        <Product ID="Standard2019Volume">
          <Language ID="ja-jp" />
        </Product>
      </Add>
    </Configuration>
    
  4. コマンドプロンプトを実行し、setup.exeがある展開先のフォルダに移動して次のコマンドを実行する。
    32ビット版、64ビット版のダウンロードが始まる。
    ダウンロード中の進捗メータは表示されないので、コマンドが終わるまで待つ。

    コマンドプロンプト
    setup /download configuration-x86.xml
    setup /download configuration-x64.xml
    

    これで次のフォルダにインストールに必要なファイルがダウンロードされている。

    • C:\Office2019\Download_x86
    • C:\Office2019\Download_x64

インストーラーファイルの作成

  1. 次の2つのファイルを作成する。(シフトJISで作成)

    configuration-template.xml
    <Configuration>
      <Add SourcePath="$SourcePath$" OfficeClientEdition="$OfficeClientEdition$" Channel="PerpetualVL2019">
        <Product ID="Standard2019Volume">
          <Language ID="ja-jp" />
        </Product>
      </Add>
    </Configuration>
    
    Office_Setup.bat
    rem Office 2019 のオフラインインストールを実行します。
    rem DVDメディアにオフラインデータを書き込んでいることを想定しています。
    @echo off
    cls
    
    :SELECTED_BITS
    echo.
    echo インストールをする Office のバージョンを入力してください。
    echo.
    echo 1:32ビット版
    echo 2:64ビット版
    echo.
    set /P InstalledBits="インストールをするバージョンは?:"
    
    rem 構成ファイルのテンプレートのパス
    set TemplatePath=%~dp0configuration-template.xml
    rem Tempフォルダに出力した構成ファイルののパス
    set ConfigurationPath=%temp%\configuration.xml
    
    rem 構成ファイルのパラメータ
    if %InstalledBits%==1 goto SELECTED_32BIT
    if %InstalledBits%==2 goto SELECTED_64BIT
    goto SELECTED_ERROR
    
    rem 32ビット版を選択
    :SELECTED_32BIT
    set SourcePath=%~dp0Download_x86
    set OfficeClientEdition=32
    goto INSTALL
    
    rem 64ビット版を選択
    :SELECTED_64BIT
    set SourcePath=%~dp0Download_x64
    set OfficeClientEdition=64
    goto INSTALL
    
    rem 入力の間違い
    :SELECTED_ERROR
    echo.
    echo.
    echo 1 または 2 を入力してください。
    echo.
    pause
    cls
    goto SELECTED_BITS
    
    :INSTALL
    rem 既に構成ファイルがあれば削除
    if exist %ConfigurationPath% del %ConfigurationPath%
    rem テンプレートを読み込みパラメータを置き換えて
    rem Tempフォルダに構成ファイルを出力する。
    setlocal enabledelayedexpansion
    for /f "delims=" %%a in (%TemplatePath%) do (
        set line0=%%a
        set line1=!line0:$SourcePath$=%SourcePath%!
        set line2=!line1:$OfficeClientEdition$=%OfficeClientEdition%!
        echo !line2!>>%ConfigurationPath%
    )
    endlocal
    
    rem setup.exeを実行
    start %~dp0setup.exe /configure %ConfigurationPath%
    
    :END
    
  2. 作成した2つのファイルとダウンロードしたインストール用データをDVDメディア等に書き込む。

    • Download_x86
    • Download_x64
    • Office_Setup.bat
    • configuration-template.xml
    • setup.exe

オフラインインストールの実行

  1. DVDメディア等に書き込んだOffice_Setup.batを実行するだけ。
5
5
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
5
5