This is my personal powershell profile that I use regularly.
I decided to setup this Repo in case anyone else finds this useful.
-
Open up the Terminal application.
-
Update and make PowerShell 7 the default.
My profile script uses syntax only compatible with PowerShell 7. Windows comes with PowerShell 5 by default. The command below references Chris Titus Tech's winutil Invoke-WPFTweakPS7 function.
This script installs PowerShell 7.
- Installs PowerShell 7
- Starts a new PowerShell 7 session that will set PowerShell 7 as the default.
- Closes the original Terminal session.
# Allows us to run PowerShell scripts. Set-ExecutionPolicy Unrestricted -Scope CurrentUser Invoke-WebRequest https://raw.githubusercontent.com/anthonymendez/Personal-Powershell-Profile/refs/heads/main/Scripts/Setup-PowerShell7.ps1 | Invoke-Expression
-
Download my PowerShell profile!
Invoke-WebRequest https://raw.githubusercontent.com/anthonymendez/Personal-Powershell-Profile/refs/heads/main/Scripts/Pull-PowerShell7.ps1 | Invoke-Expression
-
Restart the Terminal, now we'll setup/upgrade the Package Managers (winget, choco, scoop). Afterwards, we install our basic packages (gsudo, fastfetch, neovim, ohmyposh). We reload after each operation.
Invoke-WebRequest https://raw.githubusercontent.com/anthonymendez/Personal-Powershell-Profile/refs/heads/main/Scripts/Run-Setup.ps1 | Invoke-Expression
-
Customize the profile and make it your own!
Reloads the PowerShell profile in place, ensuring that all configurations are reloaded.
Checks the status of the settings sync that occurs on each new terminal session or Reload-Profile
, providing feedback on any issues.
Prints out the full history of PowerShell commands executed during the current session, similar to how cat .bash_history
works in Bash.
An alias for easily downloading the audio file (in WAV format) from videos using yt-dlp
.
Checks if the provided path is null, empty, or does not exist. This helps prevent errors when trying to perform operations on non-existent directories.
Writes the folder contents of $from
to $to
folder, recursively copying all files and subdirectories.
Writes the file contents of $from
to $to
folder. If $from
is a regex path, it will match and copy all matching files.
Handles prompting to restore the configuration for a given path/file/file regex to the given destination/target directory. This includes backup functionality to ensure that no data is lost during the restoration process.
Example: Restore-Config 'glzr' 'glzr (e.g. GlazeWM & Zebar)' "$dir/.glzr" "$HOME"
Performs the full restoration process given the source directory. This includes checking for and handling any dependencies, ensuring that all configurations are restored correctly.
Alias | Original Command | Notes |
---|---|---|
gchat | gemini | https://github.com/reugn/gemini-cli |
rprofile | Reload-Profile | |
neovim | nvim | |
vim | nvim | |
code | codium | https://hithub.com/VSCodium/vscodium |
Variable | Value |
---|---|
$GEMINI_API_KEY_PATH | $HOME/GeminiApiKey.txt |
$ENV:GEMINI_API_KEY | Get-Content $GEMINI_API_KEY_PATH |
$ZEBAR | $HOME/.glzr/zebar/config.yaml |
$ZEBAR_START | $HOME/.glzr/zebar/start.bat |
$GLAZEWM | $HOME/.glzr/glazewm/config.yaml |
$FASTFETCH | $HOME/.config/fastfetch/config.jsonc |
$OH_MY_POSH_THEME_PATH | $env:POSH_THEMES_PATH\paradox2.omp.json |
Starts a background process to copy various configurations and settings to a destination directory for backup. I have Google Drive installed on my computer so I've setup the destination folder to be backed up there.
The following folders and files are backed up:
- Powershell Profile
- PS1 Scripts in
$HOME
. - Batch scripts in
$HOME
. - oh-my-posh theme file.
- The Gemini API Key file.
- My FastFetch config folder.
- Windows 11 Terminal settings folder.
- SSH folder.
- glzr (GlazeWM, Zebar) config folder.
- List of installed winget packages.
- List of installed choco packages.
Clears output window incase previous commands, inits oh-my-posh with my custom theme,