King Zone - Chocolatey
type: channel
link: https://www.kingtam.win/tag/Chocolatey/
items: Use ADB to Push Files / Install APKs and Control Android Devices with Scrcpy
items: 透過軟件包(Chocolatey)優雅地在Windows安裝軟件

Use ADB to Push Files / Install APKs and Control Android Devices with Scrcpy
type: item
date: 2025-02-06T11:43:00+08:00
description: Use ADB to Push Files / Install APKs and Control Android Devices with ScrcpyCover.jpegAndroid Debug Bridge (ADB) is a versatile command-line tool that allows users to interact with Android devices. scrcpy is a powerful tool that allows users to control and mirror Android device's screen on computer.Prerequisites:Enable Developer Options on Android device:2025-02-05_Developer.jpgGo to Settings > About phone.Tap Build number 7 times until you see a message saying "You are now a developer!"Enable USB Debugging:2025-02-05_USB-Debugging.jpgGo to Settings > System > Developer options.Enable USB debugging.Install ADB on computer:Windows Platform (via Chocolatey)Open an elevated Command Prompt (Run as Administrator).@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"Close and reopen the Command Prompt to ensure the installation is recognized.choco install adb adb --versionLinux Platform (Ubuntu/Debian)sudo apt install adb -y adb versionPart 1: Pushing Files to an Android Device Using ADBConnect Android device to computer via USB.Make sure the device is recognized by running:adb devicesIf device is listed, you're ready to proceed. If not, check USB connection and drivers.Push File(s) to the device:Use the adb push command to copy the file to a directory on device. For example:adb push path/to/app.apk /sdcard/2025-02-06_100519.jpgadb push ./Cover.jpeg /storage/emulated/0/Backup/This command copies Cover.jpeg to the /storage/emulated/0/Backup/ directory on device.Install the APK:Use the adb install command to install the APK directly:adb install path/to/app.apkIf the APK is already on the device (e.g., in /sdcard/), you can install it using:adb shell pm install /sdcard/app.apkVerify the installation:Check if the app is installed by searching for it on device …

透過軟件包(Chocolatey)優雅地在Windows安裝軟件
type: item
date: 2021-01-18T11:52:00+08:00
description: [shadow]2021-01-18_115122.png[/shadow]透過軟件包(Chocolatey)優雅地在Windows安裝軟件前言:在Windows安裝軟件需要手動到官方網站下載軟件，再不斷地 下一步 > 下一步 完成安裝程序， 往後需要更新軟件時又要重複以上動作. 想想也覺得吃力。 看看隔壁的系統 ， 集成了軟件管理方案， 如Linux的dpkg（Apt-Get）/ RPM， 蘋果使用Brew， 一條命令就可以無人守值地完成軟件的部署或升級。其實Windows也可以一樣透過軟件包-Chocolatey優雅地在Windows安裝軟件。系統要求:Windows 7 + / Windows 2003+ 以上Windows PowerShell v2 +（PowerShell Core aka PowerShell 6）.NET Framework 4.x以上安裝Chocolatey:使用cmd.exe安裝運行以下命令：@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"2021-01-18_111157.png2021-01-18_111308.png使用PowerShell.exe安裝運行以下命令：Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))2021-01-18_080019.png2021-01-18_080213.png基本使用:choco search <app> - 搜索軟件choco install <app> - 安裝軟件choco info <app> - 查看軟件詳細信息choco list - 查看已安裝軟件choco uninstall <app> - 卸載軟件，-p刪除配置文件。choco upgrade - 更新 choco 本體和軟件列表choco upgrade <app> - 更新指定軟件choco upgrade all - 更新所有已安裝的軟件choco --help - 查看命令列表命令網址實例:我們想安裝播放器名為: potplayer可以透過chocolatey指命搜尋:以系統管理員開啟PowerShellchoco search potplayer2021-01-18_112859.png安裝 potplayerchoco install potplayer -y參數-y 是無人守值Potplayer.png透過Chocolatey同時安裝多款軟件:chocho install 7zip adobeair jre8 -y2021-01-18_080316.png2021-01-18_080901.png透過Chocolatey同時檢查及升級多款軟件:chocho upgrade all -y2021-01-18_093426.png結語:僅輸入一條指令就可以非常方便地做到無人守值“添加/升級/刪除”程序， 不需學會PowerShell， 不需複雜的指命， 只需要拷貝及貼上就能完成，如需要更進階的功能也可以自行研究。坊間也有其他軟件包可供選擇，如WinGet、Scoop等。參考網址:官方巧克力https://chocolatey.org/