Created
March 22, 2024 20:20
-
-
Save nikhil-RGB/d414fd082344673bb7ae1a24fb09a7af to your computer and use it in GitHub Desktop.
A powershell profile script which can be used to define useful shorthands. Also includes initialization for oh-my-posh and winfetch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oh-my-posh --init --shell pwsh --config ~/AppData/Local/Programs/oh-my-posh/themes/jandedobbeleer.omp.json | Invoke-Expression | |
function personal { | |
Set-Location -Path C:\PROJECTS\personal | |
} | |
function openPersonal { | |
$directoryPath = 'C:\PROJECTS\personal' | |
explorer $directoryPath | |
} | |
function projects { | |
Set-Location -Path C:\PROJECTS | |
} | |
function clubs { | |
Set-Location -Path C:\PROJECTS\clubs | |
} | |
function eclipse { | |
$FilePath = "C:\Users\Nikhil Narayanan\eclipse\java-2023-09\eclipse\eclipse.exe" | |
# Check if the file exists | |
if (Test-Path $FilePath -PathType Leaf) { | |
# Open the file using the default application | |
Start-Process $FilePath | |
} else { | |
Write-Host "File not found: $FilePath" | |
} | |
} | |
function android { | |
$FilePath = "C:\Program Files\Android\Android Studio\bin\studio64.exe" | |
# Check if the file exists | |
if (Test-Path $FilePath -PathType Leaf) { | |
# Open the file using the default application | |
Start-Process $FilePath | |
} else { | |
Write-Host "File not found: $FilePath" | |
} | |
} | |
# Use this function in an emergency to immedietly initiate a shutdown | |
function SHTD { | |
# Close all open windows | |
Stop-Process -Name explorer -Force | |
# Force Computer to Stop | |
Stop-Computer -Force | |
} | |
#Shut down all open windows | |
function killTasks { | |
Get-Process | Where-Object { $_.MainWindowTitle -ne "" } | ForEach-Object { | |
Stop-Process -Id $_.Id -Force | |
} | |
} | |
#Put computer to sleep | |
function sleep { | |
echo off | |
shutdown /h /t 0 | |
} | |
Set-Alias winfetch pwshfetch-test-1 | |
winfetch | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment