Git, CMake, Wget, 7-Zip のインストール(winget を使用)(Windows 上)
【目次】
【関連する外部ページ】
GitHub の winget-cli のページ: https://github.com/microsoft/winget-cli
winget のインストール(最近の Windows ではインストール不要)
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 のインストールの手順を説明する.
- Windows で,管理者権限でコマンドプロンプトを起動する(手順:Windowsキーまたはスタートメニュー,
cmdと入力,右クリック,「管理者として実行」を選択) - Git, CMake, Wget, 7-Zip の情報を確認する
winget search git winget search cmake winget search wget winget search 7zip - 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
- Windows の システム環境変数 Pathに,次の3つのパスを追加することにより,パスを通す
C:\Program Files\CMake\bin,C:\Program Files\7-Zip,C:\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\")" - Windows の システム環境変数 Path の確認
新しくコマンドプロンプトを開き,次のコマンドを実行する.エラーメッセージが出ないことを確認すること.
where git where git-gui where cmake where cmake-gui where 7z where wget
(2) winget を用いずにインストールする場合
Windows での Git, CMake, Wget, 7-Zip のインストールは,それぞれ次のページで説明している.
- Git のインストール(winget を使用しないインストール)(Windows 上)
- CMake のインストール(winget を使用しないインストール)(Windows 上)
- Wget のインストール(winget を使用)(Windows 上)
- 7-Zip のインストール(winget を使用しないインストール)(Windows 上)
- CMakeのインストールでは,「Add CMake path for All Users」をチェックする
- Windows の システム環境変数Pathに,次の3つの値が含まれているようにする
これは,Windows のシステム環境変数 Path の設定により,パスを通すためである.
Windows での環境変数の設定は,マイコンピュータを右クリック,プロパティ,詳細設定,環境変数をクリックの順で行うWindows の画面の表示では,「\」(円マーク)が表示される
- C:\Program Files\CMake\bin
- C:\Program Files\7-Zip
- C:\Program Files (x86)\GnuWin32\bin