winget install」コマンドにソフトウェア名を指定することでインストールを行う.インストール後,環境変数Pathにソフトウェアのパスを追加することで,コマンドプロンプトから直接実行できるようになる.「winget upgrade --all」コマンドを使用して,インストール済みのパッケージを一括で更新することもできる."/> Git, CMake, Wget, 7-Zip のインストール(winget を使用)(Windows 上)

Git, CMake, Wget, 7-Zip のインストール(winget を使用)(Windows 上)

要約wingetは,Windows Package Managerのコマンドラインツールである.Windowsでソフトウェアのインストール,更新,削除をコマンドで行える. Windowswingetをインストールするには,GitHubのwinget-cliページから最新のmsixbundleファイルをダウンロードし,実行して指示に従う.wingetを使用すると,Git,CMake,Wget,7-Zipなどのソフトウェアを簡単にインストールできる.コマンドプロンプトを管理者として実行し,「winget install」コマンドにソフトウェア名を指定することでインストールを行う.インストール後,環境変数Pathにソフトウェアのパスを追加することで,コマンドプロンプトから直接実行できるようになる.「winget upgrade --all」コマンドを使用して,インストール済みのパッケージを一括で更新することもできる.

目次

  1. winget のインストール
  2. Git, CMake, Wget, 7-Zip のインストール手順
  3. winget でインストール済みのパッケージその他を一括更新

関連する外部ページ

GitHub の winget-cli のページ: https://github.com/microsoft/winget-cli

winget のインストール(最近の Windows ではインストール不要)

最近の Windows では, winget が標準機能として搭載されているのでインストールは不要である.

wingetは,Microsoftが開発したWindowsのパッケージマネージャーである. アプリケーションの検索,インストール,更新,削除をコマンドで簡単に行える. 最新のWindows 10/11には標準搭載されているが,古いバージョンのWindowsでは手動でインストールする必要がある.

Windows でのwingetのインストール:別ページ »で説明

Git, CMake, Wget, 7-Zip のインストール手順

Git, CMake, Wget, 7-Zip は,ダウンロード,展開(解凍),ビルドのときに便利なツールである.

Windows でのインストールには,複数の方法がある. 以下,winget用いてインストールする場合と,winget用いずにインストールする場合を説明する. どちらかの方法でインストールすること.

(1) winget を用いてインストールする場合

winget を用いた Git, CMake, Wget, 7-Zip のインストールの手順を説明する.

  1. Windows で,管理者権限コマンドプロンプトを起動する(手順:Windowsキーまたはスタートメニュー,cmd と入力,右クリック,「管理者として実行」を選択)
  2. Git, CMake, Wget, 7-Zip の情報を確認する
    winget search git
    winget search cmake
    winget search wget
    winget search 7zip
    
  3. Git, CMake, Wget, 7-Zip をインストールする

    実行のとき,エラーメッセージが出ないことを確認すること.インストール中の表示をよく確認すること.

    REM Git をシステム領域にインストール
    winget install --scope machine --id Git.Git -e --silent --accept-source-agreements --accept-package-agreements --force --custom "/NORESTART /NOCANCEL /COMPONENTS=""gitlfs"" /o:EditorOption=Notepad /o:PathOption=Cmd /o:CRLFOption=CRLFCommitAsIs /o:DefaultBranchOption=main /o:SSHOption=OpenSSH /o:UseCredentialManager=Enabled"
    REM CMake をシステム領域にインストール
    winget install --scope machine --id Kitware.CMake -e --silent --accept-source-agreements --accept-package-agreements --force --custom "ADD_CMAKE_TO_PATH=System"
    REM 7-Zip をシステム領域にインストール
    winget install --scope machine --id 7zip.7zip -e --silent --accept-source-agreements --accept-package-agreements --force
    REM 7-Zip のパス設定
    powershell -NoProfile -Command "$p='C:\Program Files\7-Zip'; $c=[Environment]::GetEnvironmentVariable('Path','Machine'); if((Test-Path $p) -and $c -notlike \"*$p*\"){[Environment]::SetEnvironmentVariable('Path',\"$p;$c\",'Machine')}"
    winget install GnuWin32.Wget
    
  4. Windowsシステム環境変数 Pathに,次の3つのパスを追加することにより,パスを通す

    C:\Program Files\CMake\binC:\Program Files\7-ZipC:\Program Files (x86)\GnuWin32\bin

    管理者権限でコマンドプロンプトを開き,次のコマンドを実行する

    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\Program Files\CMake\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\Program Files\7-Zip\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\Program Files (x86)\GnuWin32\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    
  5. Windowsシステム環境変数 Path の確認

    新しくコマンドプロンプトを開き,次のコマンドを実行する.エラーメッセージが出ないことを確認すること.

    where git
    where git-gui
    where cmake
    where cmake-gui
    where 7z
    where wget
    

(2) winget を用いずにインストールする場合

Git, CMake, Wget, 7-Zip は,次のサイトで公開されている.ここからダウンロードしてインストールできる.
  • Git の公式ページ: https://git-scm.com/
  • CMake の公式ダウンロードページ: https://cmake.org/download/
  • curl の URL: https://curl.se/
  • 7-Zip の URL: https://7-zip.opensource.jp/
  • Windows での Git, CMake, Wget, 7-Zip のインストールは,それぞれ次のページで説明している.

    インストールでの要点

    winget でインストール済みのパッケージその他を一括更新

    1. Windows で,新しくコマンドプロンプト管理者として実行する
    2. 更新の操作

      コマンドプロンプトで,次のコマンドを実行する

      winget upgrade --all
      
    3. 実行の結果,エラーメッセージが出ていないことを確認する