Saturday, November 2, 2024

Curl, Wget, Winget & Powershell Install or Download Commands

After the mess I made in previous posts this summary might be useful.
    Thanks PatchMyPC, the great and powerful program downloader and updater.

Note: With both curl and wget, if a command keeps repeating without doing anything try
    curl.exe or wget.exe.(it has to do with alias or system path not worth tracing down)

curl
    Downloads into folder in which consol is active
curl -O https://patchmypc.com/freeupdater/PatchMyPC.exe
    Downloads into a specific folder
mkdir C:\Portable
curl -L https://patchmypc.com/freeupdater/PatchMyPC.exe -o C:\Portable\PatchMyPC.exe
In a multiple entry bat file I use the curl.exe command on each item
wget
    Download wget into the working directory (if link changes, fix it)
curl -o C:\Windows\System32\wget.exe https://eternallybored.org/misc/wget/1.21.4/64/wget.exe
    Downloads into folder in which consol is active
wget https://patchmypc.com/freeupdater/PatchMyPC.exe
    Downloads into specific folder
mkdir C:\Portable
wget https://patchmypc.com/freeupdater/PatchMyPC.exe -O C:\Portable\PatchMyPC.exe
    Downloads into folder in which consol is active from a list of urls in a .txt file
    (list.txt in the folder in which consol is active)
wget -i list.txt
    Downloads into specific folder from a list of urls in a .txt file
wget -i "path to list\list.txt" -P C:\Portable
If a "certifacte" error occurs ad this --no-check-certificate. It's good to add if processing a list.

powershell
    Downloads into specific folder
Invoke-WebRequest -Uri https://patchmypc.com/freeupdater/PatchMyPC.exe -OutFile $env:USERPROFILE\Desktop\PatchMyPC.exe 

winget
    Download winget installed programs list to specific folder
winget export -o %userprofile%\desktop\list.json
    Install from a downloaded .json file
winget import -i %userprofile%\desktop\list.json --accept-source-agreements --accept-package-agreements
    If  cmd or powershell is active in the same directory as the list.json
winget import -i list.json --accept-source-agreements --accept-package-agreements

Notepad++ does a great job of deleting the unwanted install lines in the exported json file.
It is also fast if you want to create a bat file from it.
    highlight a symbol ctl+f mark all & bookmark, search bookmark, remove bookmarked lines.
    highight the first " on the install line ctl+f all and replace with install commands
    alt+click and drag to highlight any column and delete.
    click and drag down/up to select rows for deletion
Notepad++ is the mother of all text editors :)

Curl, Wget, Winget & Powershell Install or Download Commands

After the mess I made in previous posts this summary might be useful.     Thanks PatchMyPC, the great and powerful program downloader and up...