OH_MY_POSH
oh-my-posh init pwsh --config 'C:\Users\Admin\scoop\apps\oh-my-posh\current\themes\blue-owl.omp.json' | Invoke-Expression
oh-my-posh init pwsh --config 'C:\Users\Admin\scoop\apps\oh-my-posh\current\themes\montys.omp.json' | Invoke-Expression
oh-my-posh init pwsh --config 'C:\Users\Admin\scoop\apps\oh-my-posh\current\themes\microverse-power.omp.json' | Invoke-Expression
microverse-power craver half-life
oh-my-posh init pwsh --config 'C:\Users\Admin\scoop\apps\oh-my-posh\current\themes\craver.omp.json' | Invoke-Expression
Icons forder, xaml, css, html,...
Import-Module Terminal-Icons
Thiết lập biến môi trường để mở "visual studio 2022"
$env:VS = "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe"
Tạo hàm trong PowerShell mở "visual studio 2022"
function vs2022 {
param(
[string]$SolutionPath
)
Start-Process $env:VS $SolutionPath
}
Thiết lập biến môi trường để mở "ggChrome"
$env:CHROME_PATH = "C:\Program Files\Google\Chrome\Application\chrome.exe"
Tạo hàm trong PowerShell mở "ggChrome"
function gg{
param(
[string]$SolutionPath
)
Start-Process $env:CHROME_PATH $SolutionPath
}
Tạo hàm trong PowerShell để mở Gmail trên Chrome
function gmail {
Start-Process "chrome.exe" https://mail.google.com/
}
Tạo hàm trong PowerShell để mở Gmail trên Chrome
function fb{
Start-Process "chrome.exe" "https://www.facebook.com/"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function github{
Start-Process "chrome.exe" "https://github.com/anhhducnguyen"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function chatgpt{
Start-Process "chrome.exe" "https://chat.openai.com/"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function canvas{
Start-Process "chrome.exe" "https://canvas.phenikaa-uni.edu.vn/"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function yt{
Start-Process "chrome.exe" "https://www.youtube.com/"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function mess{
Start-Process "chrome.exe" "https://www.facebook.com/messages/t/100026364283541/"
}
function aws{
Start-Process "chrome.exe" "https://awsacademy.instructure.com/login/canvas"
}
Tạo hàm trong PowerShell để mở SQLSERVER
function sqlserver{
Start-Process -FilePath "C:\Program Files (x86)\Microsoft SQL Server Management Studio 19\Common7\IDE\Ssms.exe"
}
Tạo hàm trong PowerShell để mở MYSQL
function mysql{
Start-Process -FilePath "C:\Program Files\MySQL\MySQL Workbench 8.0\MySQLWorkbench.exe"
}
Tạo hàm trong PowerShell để mở VISUAL STUDIO CODE trên Chrome
Tạo hàm để hiển thị các file gần đây
function recent{
# Get-ChildItem -Path $Env:APPDATA\Microsoft\Windows\Recent | Where-Object { $.Extension -eq ".lnk" } | Sort-Object LastWriteTime | ForEach-Object { $.Name }
Get-ChildItem -Path $Env:APPDATA\Microsoft\Windows\Recent |
Where-Object { $_.Extension -eq ".lnk" } |
Sort-Object LastWriteTime -Descending |
Select-Object -First 10 |
Format-Table Name, LastWriteTime -AutoSize
}
function find{
param (
[string]$Pattern
)
if (-not $Pattern) {
Write-Output "Please provide a file pattern."
return
}
Get-ChildItem -Recurse -Filter $Pattern
}
function findDir {
param (
[string]$Pattern
)
if (-not $Pattern) {
Write-Output "Please provide a directory name pattern."
return
}
Get-ChildItem -Directory -Recurse | Where-Object { $_.Name -like $Pattern }
}
function catt{
Get-Content .\composer.json | ForEach-Object -Begin {$i = 1} -Process { "{0} {1}" -f $i++, $_ }
}
Hỗ trợ các biến môi trường
function support{
echo "These are common quick support commands used in a variety of situations:"
echo ""
echo "start a work area on the Desktop"
echo " vs2022 Visual Studio 2022"
echo ""
echo "start a work area on the NetWork (google Chrome)"
echo " canvas Canvas"
echo " fb Facebook"
echo " gmail Gmail"
echo " github Github"
echo " gg Google Chrome"
echo " mess Messages"
echo " yt Youtube"
echo ""
echo "examine the history and state"
echo " recent Displays recently opened files from newest to oldest"
echo ""
echo "commit and push code github"
echo " CommitAndPush CommitAndPush -commit 'first_commit' "
}
function open{
Start-Process
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function translation{
Start-Process "chrome.exe" "https://translate.google.com/?hl=vi"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function localhost{
Start-Process "chrome.exe" "http://localhost/"
}
function CopyPath {
$currentPath = Get-Location
Write-Host "Current path is : $currentPath"
$currentPath | Set-Clipboard
Write-Host "Copy successfully!"
}
function CommitAndPush {
param(
[string]$commit
)
# Kiểm tra xem Git có được cài đặt và đang hoạt động không
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
Write-Host "Git is not installed or not accessible."
return
}
# Thực hiện commit và push
try {
# Thực hiện git add để đưa tất cả các thay đổi vào staging area
git add .
# Thực hiện commit với message được chỉ định
git commit -m $commit
# Thực hiện push lên remote repository
git push
Write-Host "Code committed and pushed successfully."
}
catch {
Write-Host "Error occurred: $_"
}
}
function touch {
param (
[string]$Path
)
if (-not (Test-Path $Path)) {
New-Item -Path $Path -ItemType File
Write-Output "File '$Path' has been created."
} else {
Write-Output "File '$Path' already exists."
}
}
OH_MY_POSH
oh-my-posh init pwsh --config 'C:\Users\Admin\scoop\apps\oh-my-posh\current\themes\blue-owl.omp.json' | Invoke-Expression
oh-my-posh init pwsh --config 'C:\Users\Admin\scoop\apps\oh-my-posh\current\themes\montys.omp.json' | Invoke-Expression
oh-my-posh init pwsh --config 'C:\Users\Admin\scoop\apps\oh-my-posh\current\themes\microverse-power.omp.json' | Invoke-Expression
https://ohmyposh.dev/docs/themes#microverse-power
microverse-power craver half-life
oh-my-posh init pwsh --config 'C:\Users\Admin\scoop\apps\oh-my-posh\current\themes\craver.omp.json' | Invoke-Expression
Icons forder, xaml, css, html,...
Import-Module Terminal-Icons
Thiết lập biến môi trường để mở "visual studio 2022"
$env:VS = "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe"
Tạo hàm trong PowerShell mở "visual studio 2022"
function vs2022 {
param(
[string]$SolutionPath
)
Start-Process $env:VS $SolutionPath
}
Thiết lập biến môi trường để mở "ggChrome"
$env:CHROME_PATH = "C:\Program Files\Google\Chrome\Application\chrome.exe"
Tạo hàm trong PowerShell mở "ggChrome"
function gg{
param(
[string]$SolutionPath
)
Start-Process $env:CHROME_PATH $SolutionPath
}
Tạo hàm trong PowerShell để mở Gmail trên Chrome
function gmail {
Start-Process "chrome.exe" https://mail.google.com/
}
Tạo hàm trong PowerShell để mở Gmail trên Chrome
function fb{
Start-Process "chrome.exe" "https://www.facebook.com/"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function github{
Start-Process "chrome.exe" "https://github.com/anhhducnguyen"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function chatgpt{
Start-Process "chrome.exe" "https://chat.openai.com/"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function canvas{
Start-Process "chrome.exe" "https://canvas.phenikaa-uni.edu.vn/"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function yt{
Start-Process "chrome.exe" "https://www.youtube.com/"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function mess{
Start-Process "chrome.exe" "https://www.facebook.com/messages/t/100026364283541/"
}
function aws{
Start-Process "chrome.exe" "https://awsacademy.instructure.com/login/canvas"
}
Tạo hàm trong PowerShell để mở SQLSERVER
function sqlserver{
Start-Process -FilePath "C:\Program Files (x86)\Microsoft SQL Server Management Studio 19\Common7\IDE\Ssms.exe"
}
Tạo hàm trong PowerShell để mở MYSQL
function mysql{
Start-Process -FilePath "C:\Program Files\MySQL\MySQL Workbench 8.0\MySQLWorkbench.exe"
}
Tạo hàm trong PowerShell để mở VISUAL STUDIO CODE trên Chrome
Tạo hàm để hiển thị các file gần đây
function recent{$Env:APPDATA\Microsoft\Windows\Recent | Where-Object { $ .Extension -eq ".lnk" } | Sort-Object LastWriteTime | ForEach-Object { $.Name }
# Get-ChildItem -Path
Get-ChildItem -Path $Env:APPDATA\Microsoft\Windows\Recent |
Where-Object { $_.Extension -eq ".lnk" } |
Sort-Object LastWriteTime -Descending |
Select-Object -First 10 |
Format-Table Name, LastWriteTime -AutoSize
}
function find{
param (
[string]$Pattern
)
}
function findDir {
param (
[string]$Pattern
)
}
function catt{
Get-Content .\composer.json | ForEach-Object -Begin {$i = 1} -Process { "{0} {1}" -f $i++, $_ }
}
Hỗ trợ các biến môi trường
function support{
echo "These are common quick support commands used in a variety of situations:"
echo ""
echo "start a work area on the Desktop"
echo " vs2022 Visual Studio 2022"
echo ""
echo "start a work area on the NetWork (google Chrome)"
echo " canvas Canvas"
echo " fb Facebook"
echo " gmail Gmail"
echo " github Github"
echo " gg Google Chrome"
echo " mess Messages"
echo " yt Youtube"
echo ""
echo "examine the history and state"
echo " recent Displays recently opened files from newest to oldest"
echo ""
echo "commit and push code github"
echo " CommitAndPush CommitAndPush -commit 'first_commit' "
}
function open{
Start-Process
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function translation{
Start-Process "chrome.exe" "https://translate.google.com/?hl=vi"
}
Tạo hàm trong PowerShell để mở GitHub trên Chrome
function localhost{
Start-Process "chrome.exe" "http://localhost/"
}
function CopyPath {
$currentPath = Get-Location
Write-Host "Current path is : $currentPath"
$currentPath | Set-Clipboard
Write-Host "Copy successfully!"
}
function CommitAndPush {
param(
[string]$commit
)
}
function touch {
param (
[string]$Path
)
}