Fist of Tech

Pretty useless cat facts and PowerShell – (there is also a picture of a cat)

Photo by Pixabay on

Does this seem familiar? You are sitting in a meeting and the discussion is heated. Your thoughts wander and suddenly you are directly addressed. That’s exactly when you should have had a cat fact at hand to defuse the situation. We show you how to have a cat fact ready every time you need one.

Photo by Pixabay on

The first thing you need is a cat API, thank god there is already one out there. The site provides a nice Rest API. Cats and ninjas, that’s probably the best combination ever. Below ist the function we will use for all the following snippets. If you use Get-CatFact -TargetLanguage you can choose all the short codes from Google translate. If you do not use that parameter english will be the default language.

Function Get-CatFact{
    param (
        $TargetLanguage = "En"

    $Result = Invoke-WebRequest -Uri "" | ConvertFrom-Json
    $Text = $Result.fact
    if($TargetLanguage.ToLower() -ne "en"){
        $Uri = "$($TargetLanguage)&dt=t&q=$Text".Replace(" ", "%20").Replace("\", "\\")
        $Response = Invoke-WebRequest -Uri $Uri -Method Get
        [String]$Text = ($Response.Content.Split("`"")[1]) -replace "`"",""
    return $Text

Replace your clipboard with a random cat fact every couple of seconds.

No clue why anyone would want to do that but here we go:

    Get-CatFact | Set-Clipboard
    Start-Sleep -Seconds 5

Annoy yourself with a cat fact everytime you start your computer

To have a nifty pop up for your cat fact, or if you just want to annoy your coworker follow these steps. And paste the script in to the startup location (Windows + R and type shell:startup).

$Wshell = New-Object -ComObject Wscript.Shell
$Output = $Wshell.Popup((Get-CatFact))

Attach the cat fact to your context menu

To instantly have a new fact at hand just add your script to your context menu.

#Add this and the Get-CatFact function to a script.
Get-CatFact | Set-Clipboard

After setting up your script add the following to your registry. Change the highlighted line to your script path.

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\Get a cat fact]
@="&Get a cat fact"
[HKEY_CLASSES_ROOT\Directory\Background\shell\Get a cat fact\command]
@="powershell.exe -windowstyle hidden -file C:\\Scripts\\Catfacts.ps1"

Exit mobile version