Skip to content

Better Powershell script #2

@simpleyoutube

Description

@simpleyoutube

Use this instead:

Minimal profile: UTF‑8 + Fastfetch with explicit config path

try {
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$OutputEncoding = [System.Text.UTF8Encoding]::new($false)
chcp 65001 > $null
} catch {}

Function to clear screen and redraw Fastfetch

function global:Clear-Host {
# Use Console.Clear() instead of Clear-Host
[Console]::Clear()
if (Get-Command fastfetch -ErrorAction SilentlyContinue) {
fastfetch -c "$env:USERPROFILE/.config/fastfetch/config.jsonc"
}
}

Set aliases safely

if (-not (Get-Alias clear -ErrorAction SilentlyContinue)) { Set-Alias clear Clear-Host }
if (-not (Get-Alias cls -ErrorAction SilentlyContinue)) { Set-Alias cls Clear-Host }

Initial Fastfetch display

Clear-Host

this will print the art again even after you run clear or cls

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions