Showing posts with label curl. Show all posts
Showing posts with label curl. Show all posts

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
   -o your download path and/or file name. -O use the file name provide from the URL
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 :)

Friday, October 4, 2024

Downloading With Curl

Open CMD in directory into which you want to download the file.
    Shift + Right Click option "open Powershell window here"
    Powershell will run every CMD command plus many more so either works fine.

curl -O -L https://www.carifred.com/uvk/UVKPortable.exe
-O download the file named
-L follows redirects
It sometimes I need -O -L so I just usually use them.

This is how to redirect, within the command line, into the location in which you want the download.

curl -o C:\Portable\UVK.exe https://www.carifred.com/uvk/UVKPortable.exe

One way to structure for multiple file downloads.
    After the initial curl command, list them one after the other separated by a space.
        I think this is more difficult to edit.
curl -O -L https://patchmypc.com/freeupdater/PatchMyPC.exe https://www.carifred.com/uvk/UVKPortable.exe
    I prefer them in a vertical list with curl commands for each item.

Wget is great also. Maybe faster for some reason.
    It requires installing wget, wereas Curl is part of Win 10 and beyond.
        There is Wget2 but the added 2 in the command irritates me :)
            or find the wget.exe file somewhere and paste it into windows\system32
            Again, a continuous list separated by a single space.
    Just download the exe and place in C:\Windows\System32
    curl -o C:\Windows\System32\wget.exe https://eternallybored.org/misc/wget/1.21.4/64/wget.exe
or
    download and send to the directory
    curl https://eternallybored.org/misc/wget/1.21.4/64/wget.exe -o "C:\Windows\System32\wget.exe"
or
winget install JernejSimoncic.Wget
Open CMD in folder desired for downloads

wget --no-check-certificate  https://patchmypc.com/freeupdater/PatchMyPC.exe https://www.carifred.com/uvk/UVKPortable.exe https://www.sordum.org/files/download/defender-exclusion-tool/ExcTool.zip

or

create a text file containing a vertical list of all the urls and name the file "some_name.txt"
    then open cmd and cd to the folder containing the txt file
        wget -i some_name.txt
better yet
        wget --no-check-certificate -i some_name.txt

If wget does not work, just find the wget.exe file somewhere and copy it to the Windows\System32 folder.
fix certificate errors with wget --no-check-certificate http://example.com

Symenu Stuff (Irritating Updates)

I've used Symenu for ages and appreciate the broad selection of apps and the easy updating of those apps. The easy update days are over,...