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 :)

Saturday, October 26, 2024

Linking To A Specific Spot On A Url Page

Linking to a specific spot on a url page
url#:~:text=word1%20word2%20word3

%20 is used in place of a space

Find or if creating a post, add a word or phrase to which you want to link within the page.
Then create a link as usual and add the above without a space after the url

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

Wednesday, October 2, 2024

Windows 11 Install - Recent

Depending on the Win11.iso
    If offered to set up work/school, do that. Any domain name works.
    New iso's will not have work/school option.

Installing starts
First reboot 79%
Second reboot 62%
"Just a moment..."
Yes, Yes, Skip
"Let's connect you to a network"
shift + f10
oobe\bypassnro
"Just a moment..."
reboot
"Just a moment..."
Yes, Yes, Skip
"Let's connect you to a network"
click "I don't have internet"
Name
Next "blank password" set up later
No to everything
Accept
Hi

sysdm.cpl advanced>performanc>settings turn off everything that moves, fades or slides
indexing options remove everything except start menu

cmd
winget upgrade
to get list - then likely these need upgrading - ignore the others
winget install Microsoft.AppInstaller
winget install Microsoft.WindowsTerminal
winget install Microsoft.VCLibs.Desktop.14

winget install -e --id=RevoUninstaller.RevoUninstaller
 remove some stuff you don't like or need

Chris Titus WinUtil
  powershell admin
    irm christitus.com/win | iex
      standard tweeks, updates security, create shorcut

paste in notepad
  save as "somename.bat"
    right click, run as admin

---
winget install -e --id=Notepad++.Notepad++
winget install -e --id=Chocolatey.Chocolatey
winget install -e --id=Chocolatey.ChocolateyGUI
winget install -e --id=MartiCliment.UniGetUI
winget install -e --id=7zip.7zip
winget install -e --id=voidtools.Everything
winget install -e --id=ShareX.ShareX
winget install -e --id=winaero.tweaker
winget install -e --accept-package-agreements --id=9PF4KZ2VN4W9
winget install -e --accept-package-agreements --id=9P8LTPGCBZXD
pause
---

cmd
choco install launchyqt -y

Remember to:
sysdm.cpl > Advanced > Performance > turn off Animate, Fade, Slide
indexing options > leave only Start Menu

What about that Schneegans autounattended.xml?

Here we go . . .
    with aggressive app removal

create autounattended.xml
    If on Virtualbox
        start Anyburn edit win-iso and add autounattended.xml > rebuild > save
    If on hardware
        copy autounattended.xml and Win.iso to flash drive installer.

Start Install
"We are getting a few things ready"
Choose drive
"Installing Windows"
78% reboot #1
"Installing"
58% starts running powershell scripts
reboot #2
"Just a moment"
Holly Hanna!
"Checking for updates"
"Hi"
More powershell magic being run
    The programs were uninstalled but the shortcuts are still on start
Yikes, I can't log on . . .
OK, I intended to have a blank password but left the default "password" in xml file.
So, "password" it is then :)
Remember to delete "password" in the autounattended file if you want "blank" :)


Strange:
    Some Win.iso versions won't pick up the inserted autounattend.xml on VB

Too Much? :)





Monday, September 30, 2024

Winget Installing Multiple Programs

Using a .bat file

Note the agreements arguement with the windows store app

winget install -e --id=Chocolatey.Chocolatey
winget install -e --id=7zip.7zip
winget install -e --accept-package-agreements --id=9PF4KZ2VN4W9
pause

(the last install is a windows store package)

    Or

winget install --accept-package-agreements Chocolatey.Chocolatey 7zip.7zip 9PF4KZ2VN4W9
pause

Using a .ps1 file

Nice to have all the arguments on one line. All the "" & commas are a pain.

#Install software
$SoftwareToInstall = "MartiCliment.UniGetUI", "7zip.7zip"
foreach ($Software in $SoftwareToInstall) {
    WinGet.exe install $software --silent --force --accept-source-agreements --accept-package-agreements --disable-interactivity --source winget
}

Windows Sandbox makes it difficult to install Winget.

Here is a .ps1 script that works now but things change.

#Install WinGet, used https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
Start-Transcript C:\users\wdagutilityaccount\desktop\Installing.txt
$progressPreference = 'silentlyContinue'
Write-Information "Downloading WinGet and its dependencies..."
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile $env:temp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $env:temp\Microsoft.VCLibs.x64.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile $env:temp\Microsoft.UI.Xaml.2.8.x64.appx
Add-AppxPackage $env:temp\Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage $env:temp\Microsoft.UI.Xaml.2.8.x64.appx
Add-AppxPackage $env:temp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

Stop-Transcript
Rename-Item -Path C:\users\wdagutilityaccount\desktop\Installing.txt -NewName C:\users\wdagutilityaccount\desktop\Done.txt 

Hints:
    For bat scripts just copy/paste into notepad and save/name file "anything.bat"
        Double click should run in Windows & Sandbox
    For ps1 scripts just copy/paste into notepad and save/name file "anything.ps1"
        In regular Windows, double clicking the file will run it.
        In Sandbox, right click and "run with Powershell"

Which one do I like for installing multiple probrams?
    I like the bat file's verticle list and ease of editing
    I also like the continuous list. 
    Just remember store apps need additional argument to avoid interaction during install but can be stated once  with continuous list version.
I guess you could go the Full Monty with below or pick and choose as needed.
--silent --force --accept-source-agreements --accept-package-agreements --disable-interactivity --source winget


Wednesday, September 25, 2024

Powershell 7 - How The Heck Do I Start It

 I installed Powershell 7.
    The default is v5 and it remains the default

But how do you run v7?

Bring up a Command Prompt (or Powershell v5) and type "pwsh".
    CMD is the most interesting . . .

Here is the original CMD window

It tuns into this

When done in Powershell it does this

OK, your will look different. I'm running the Chris Titus profile.

Remember, Powershell can run every cmd command.
    You don't need to do this but if you type cmd.exe once, Powershell will act more like cmd. It will perform the commands without cmd.exe but may not display the same.


Tuesday, September 24, 2024

Bat File To Exe With Icon

I still like RocketDock. The longer I use any PC, the more things go into my RocketDock.
I prefer using it as portable enabling copying to another machine. The problem is the links point to the wrong place and the attached icons need to be reattached.

One solution is to create a bat file to access the location and then convert the bat file to exe and embed the icon.

The bat file might be this:

@ECHO OFF 
start "" "%userprofile%\Pictures\Gimp Work"

or

@ECHO OFF 
start "" https://www.dropbox.com/h

Then grab this (or get the install version on MajorGeeks)
 (When it creates the exe it makes a temporary file & Defender freaks out is you have automatic submission turned on. Just ignore it.)

OH boy, you just have a jpg or png file? Use IcoFX
curl -o %userprofile%\Desktop\icofx.zip http://www.portablefreeware.com/download.php?id=1224


Monday, September 23, 2024

Windows Sandbox Testing Winget

Enable Windows Sandbox Feature
    copy/paste between sandbox & host system works
open sandbox

Installing Winget is tricky but easier in 10 than 11
In windows 10 use this ps1 script I finally found  HERE 
    or
curl -O -L https://github.com/HarmVeenstra/Powershellisfun/raw/refs/heads/main/Create%20a%20development%20Windows%20Sandbox/Install_WinGet_and_Software.ps1
    In Windows 10 Winget will now work. The script will not complete in Windows 11.

This method will work in both 10 and 11 and may be the best.
Download UnigetUI installer from HERE 
UnigetUI will install a working Winget and be able to download Winget files.
CMD and/or Powershell, however will not recognize winget.exe because it's not in the System Envirenment Variable Path.
    winget.exe is here C:\Program Files\UningetUI\winget-cli_x64
        add the path to into Envirenment Variables
A bonus to this method is Chocolatey will be installed.

Winget export & import commands
Export command:
winget export -o %userprofile%\desktop\appslist --accept-source-agreements

Import command
winget import -i %userprofile%\desktop\appslist --ignore-versions --accept-package-agreements --accept-source-agreements

It takes awhile to load so be patient.

If app install fails error code 1 check VCRedist.2015+.x64 is installed.

If errors occur validate the json file here https://jsonlint.com/
Also check the file extension matches the command.
    Sandbox defaults to not show file extensions.
Open file explorer > view and check file extension. 
    You need to either delete ".txt" or add .txt to the import command.

A few install popus appeared but the install was not affected.
    RocketDock failed with hash not match. Couldn't install without swithches.
    Failures do not stop the installs.

By the way . . . RocketDock installs just fine in UnigetUI with Chocolatey.
UnigetUI installs Chocolatey when you start it the first time.
I also get LaunchyQT with Chocolatey.

            choco install rocketdock launchyqt irfanviewplugins -y

Observation
    UnigetUi bundles.json sometimes fails on simple installs like 7zip but not always.
    Where as Winget appslist.json does not fail

For now, I prefer Winget appslist.json installs.

appslist file

{
"$schema" : "https://aka.ms/winget-packages.schema.2.0.json",
"CreationDate" : "2024-09-29T09:35:27.698-00:00",
"Sources" : 
[
{
"Packages" : 
[
{
"PackageIdentifier" : "MartiCliment.UniGetUI"
},
{
"PackageIdentifier" : "ShareX.ShareX"
},
{
"PackageIdentifier" : "AutoHotkey.AutoHotkey"
},
{
"PackageIdentifier" : "voidtools.Everything"
},
{
"PackageIdentifier" : "HexChat.HexChat"
},
{
"PackageIdentifier" : "IrfanSkiljan.IrfanView"
},
{
"PackageIdentifier" : "Mozilla.Firefox"
},
{
"PackageIdentifier" : "Notepad++.Notepad++"
},
{
"PackageIdentifier" : "Proton.ProtonVPN"
},
{
"PackageIdentifier" : "VideoLAN.VLC"
},
{
"PackageIdentifier" : "winaero.tweaker"
},
{
"PackageIdentifier" : "nepnep.neofetch-win"
},
{
"PackageIdentifier" : "7zip.7zip"
},
{
"PackageIdentifier" : "AdrienAllard.FileConverter"
},
{
"PackageIdentifier" : "Microsoft.PowerShell"
},
{
"PackageIdentifier" : "Oracle.VirtualBox"
},
{
"PackageIdentifier" : "Google.Chrome.EXE"
},
{
"PackageIdentifier" : "2BrightSparks.SyncBackFree"
},
{
"PackageIdentifier" : "Chocolatey.ChocolateyGUI"
},
{
"PackageIdentifier" : "AOMEI.Backupper.Standard"
},
{
"PackageIdentifier" : "flux.flux"
},
{
"PackageIdentifier" : "LocalSend.LocalSend"
},
{
"PackageIdentifier" : "Microsoft.PowerToys"
}
],
"SourceDetails" : 
{
"Argument" : "https://cdn.winget.microsoft.com/cache",
"Identifier" : "Microsoft.Winget.Source_8wekyb3d8bbwe",
"Name" : "winget",
"Type" : "Microsoft.PreIndexed.Package"
}
},
{
"Packages" : 
[
{
"PackageIdentifier" : "9N0DX20HK701"
}
],
"SourceDetails" : 
{
"Argument" : "https://storeedgefd.dsx.mp.microsoft.com/v9.0",
"Identifier" : "StoreEdgeFD",
"Name" : "msstore",
"Type" : "Microsoft.Rest"
}
}
],
"WinGetVersion" : "1.8.1911"
}


Wednesday, September 18, 2024

Let AI Help Blog Posting

I've only done this once and yep, it worked.

Create the blog post. Copy the text to clipboard.

Go to Claude and paste it in. 
Claude will create and format the blog post.
Download the *.md file.
Open the *.md file and copy the text

Go to Free Markdown and past the text. 
Free Markdown will interpret the md format and create the html file.

Now copy the raw html and paste it into your blog.

Here is what was produced from the above text . . .
***LOL, It's overkill but it does work***
So, now I've done it twice.

From Markdown to HTML: A Simple Workflow for Bloggers

Have you ever struggled with formatting your blog posts? I recently discovered a straightforward process that makes it easy to go from a simple text draft to a fully formatted HTML blog post. Here's the step-by-step workflow I've used successfully:

The Process

  1. Draft Your Content: Start by writing your blog post content in plain text.

  2. Use Claude for Formatting:

    • Copy your draft text.
    • Paste it into Claude (an AI assistant).
    • Ask Claude to format the text as a blog post.
  3. Get Your Markdown File:

    • Claude will provide a formatted version of your post in Markdown.
    • Download the .md file Claude creates.
  4. Convert Markdown to HTML:

    • Open the downloaded .md file.
    • Copy all the text from this file.
    • Go to a free Markdown-to-HTML converter (like "Free Markdown").
    • Paste your Markdown text into the converter.
  5. Finalize Your HTML:

    • The converter will interpret the Markdown and generate HTML.
    • Copy the raw HTML output from the converter.
  6. Publish Your Post:

    • Paste the HTML into your blog's editor or content management system.

Why This Works

This method is effective because it combines the ease of writing in plain text, the formatting capabilities of AI, and the universality of HTML. By using Markdown as an intermediary step, you get a clean, structured format that's easy to convert to polished HTML.

Conclusion

I've only tried this process once, but it worked seamlessly. It's a great way to streamline your blogging workflow, especially if you're not comfortable writing directly in HTML or using complex content management systems.

Give it a try for your next blog post and see how it simplifies your publishing process!

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