0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【改訂】Wingetコマンドによるアプリ更新

Last updated at Posted at 2025-07-28

ご挨拶

1年ぶりに自分のコマンドを見てみると効率が悪いというか、耳がタコになるというか……
過去記事の書き直しです。

過去記事  wingetコマンドによるブラウザやAdobe、Teamsアプリの更新

目次

1.注意
2.batファイル
3.ps1ファイル






注意!!

検証を重ねてコード掲載に至っておりますが、ご利用は最新の公式情報を参照の上、自己責任でお願い申し上げます。
また、ある程度コマンドプロンプトや、PowerShellを実行経験済みの方が参考にされる事をお勧めします。
一部手順を省略している場合があり、お使いのOS環境によりましては上手く動作しない場合がございます。

本記事は下記3点をご理解頂いている前提で書いております。
ご不安な方は過去記事  wingetコマンドによるブラウザやAdobe、Teamsアプリの更新 をお読みください。

わかる方はこのままレッツGO~♪

①「.bat」ファイルの作成方法

②「.ps1」ファイルの作成方法

③アップデートするアプリの探し方と注意点




batファイル


.batファイルのコード
@echo off
pushd %~dp0
:: 管理者実行のコード
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)

set /p answer="WindowsUpdateとWingetを実行しますか?(y/n):"

if "%answer%" == "y" (
  echo 実行します。


:: 「***」の部分は任意のファイル名にしてください。
powershell -Noprofile -ExecutionPolicy Unrestricted .\***.ps1
) else if "%answer%" == "n" (
  echo かしこまりました。実行を中止します。
)




ps1ファイルの書き方




.ps1ファイルのコード

# アップグレード対象のアプリ一覧
$apps = @(
    "Microsoft.Edge",
    "Google.Chrome",
    "Mozilla.Firefox",
    "Adobe.Acrobat.Reader.32-bit",
    "Microsoft.Teams"
)
 
foreach ($app in $apps) {
    winget list --id $app -e
    winget upgrade --id $app --force
}




テスト

以上です。最後まで閲覧いただきありがとうございました。

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?