Skip to content

Instantly share code, notes, and snippets.

@u01jmg3
Last active November 8, 2023 10:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save u01jmg3/a9fdc69cf6d09efcc80a7ef2aca3f81e to your computer and use it in GitHub Desktop.
Save u01jmg3/a9fdc69cf6d09efcc80a7ef2aca3f81e to your computer and use it in GitHub Desktop.
Pimp up the Windows command prompt
@echo off
:: Clear Microsoft version notice displayed by an
:: Administrator CMD & shells opened by Fork
cls
:: Enable unicode support
chcp 65001 >NUL
if exist .\laravel cd laravel
set "isMorning=false"
set "isAfternoon=false"
set "isEvening=false"
for /f "delims=:" %%A in ("%time%") do (
if %%A LSS 12 (set "isMorning=true") else if %%A LSS 17 (set "isAfternoon=true") else (set "isEvening=true")
)
if %isMorning% == true ( goto :morning )
if %isAfternoon% == true ( goto :afternoon )
if %isEvening% == true ( goto :evening )
:morning
echo __ __ _ _ _
echo ^| \/ ^| ___ _ __ _ __ (_)_ __ __ _ ^| ^| ___ _ __ _ __ _ _ ^| ^|
echo ^| ^|\/^| ^|/ _ \^| '__^| '_ \^| ^| '_ \ / _` ^| _ ^| ^|/ _ \^| '_ \^| '_ \^| ^| ^| ^| ^| ^|
echo ^| ^| ^| ^| (_) ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| (_^| ^| _ ^| ^|_^| ^| (_) ^| ^| ^| ^| ^| ^| ^| ^|_^| ^| ^|_^|
echo ^|_^| ^|_^|\___/^|_^| ^|_^| ^|_^|_^|_^| ^|_^|\__, ^|( ) \___/ \___/^|_^| ^|_^|_^| ^|_^|\__, ^| (_)
echo ^|___/ ^|/ ^|___/
goto:userdetails
:afternoon
echo _ __ _ _ _
echo / \ / _^| ^|_ ___ _ __ _ __ ___ ___ _ __ ^| ^| ___ _ __ _ __ _ _ ^| ^|
echo / _ \ ^| ^|_^| __/ _ \ '__^| '_ \ / _ \ / _ \^| '_ \ _ ^| ^|/ _ \^| '_ \^| '_ \^| ^| ^| ^| ^| ^|
echo / ___ \^| _^| ^|^| __/ ^| ^| ^| ^| ^| (_) ^| (_) ^| ^| ^| ^| _ ^| ^|_^| ^| (_) ^| ^| ^| ^| ^| ^| ^| ^|_^| ^| ^|_^|
echo /_/ \_\_^| \__\___^|_^| ^|_^| ^|_^|\___/ \___/^|_^| ^|_^|( ) \___/ \___/^|_^| ^|_^|_^| ^|_^|\__, ^| (_)
echo ^|/ ^|___/
goto:userdetails
:evening
echo _____ _ _ _
echo ^| ____^|_ _____ _ __ (_)_ __ __ _ ^| ^| ___ _ __ _ __ _ _ ^| ^|
echo ^| _^| \ \ / / _ \ '_ \^| ^| '_ \ / _` ^| _ ^| ^|/ _ \^| '_ \^| '_ \^| ^| ^| ^| ^| ^|
echo ^| ^|___ \ V / __/ ^| ^| ^| ^| ^| ^| ^| (_^| ^| _ ^| ^|_^| ^| (_) ^| ^| ^| ^| ^| ^| ^| ^|_^| ^| ^|_^|
echo ^|_____^| \_/ \___^|_^| ^|_^|_^|_^| ^|_^|\__, ^|( ) \___/ \___/^|_^| ^|_^|_^| ^|_^|\__, ^| (_)
echo ^|___/ ^|/ ^|___/
goto:userdetails
:userdetails
echo %COMPUTERNAME%\%USERNAME%
goto:doskey
:doskey
@doskey /?=echo ~ .. artisan[?] atob[?] btoa[?] cat[?] clear cp[?] db diff[?] dump fix grep[?] ls mv[?] o rm[?] scan version whereis[?] x
@doskey ~=cd /d "%USERPROFILE%" $t dir /b /ogen
@doskey ..=cd .. $t dir /b /ogen
@doskey cd=cd $* $t dir /b /ogen
@doskey clear=cls
@doskey cat=type $*
@doskey cp=copy $*
@doskey diff=fc $*
@doskey ls=dir /b /ogen $*
@doskey mv=move $*
@doskey o=explorer . $t echo Opening...
@doskey rm=del $*
:: Add C:\Program Files\grepWin to PATH
@doskey grep=grepWin /i:yes /searchpath:"." /searchfor:"$*" /regex:no /executesearch $t echo Opening...
@doskey ecsphp=ecs check --fix .
@doskey rectorphp=rector process app $*
@doskey scanphp4all=if exist phpcs-report.txt del phpcs-report.txt $t cls $t phpcs -p -s --colors -d memory_limit=1G --ignore=*/bootstrap/*,*/config/*,*/framework/*,*/node_modules/*,*/tests/*,*/vendor/* --extensions=php --report-file="phpcs-report.txt" --standard="C:\Users\%USERNAME%\www\~repositories\documentation\coding-standards\PHP\CodeSniffer\CustomPHPCS" --exclude=Generic.Files.LineLength,PSR12.Properties.ConstantVisibility . $t for %%a in (phpcs-report.txt) do if %%~za GTR 2 (start %%a) else (del %%a)
@doskey fixphp4all=phpcbf -d memory_limit=1G --ignore=*/bootstrap/*,*/config/*,*/framework/*,*/node_modules/*,*/overrides/*,*/tests/*,*/vendor/* --extensions=php --standard="C:\Users\%USERNAME%\www\~repositories\documentation\coding-standards\PHP\CodeSniffer\CustomPHPCS" .
@doskey scanphp=if exist phpcs-error-report.txt del phpcs-error-report.txt $t cls $t phpcs -p -n -s --colors -d memory_limit=1G --ignore=*/bootstrap/*,*/config/*,*/framework/*,*/node_modules/*,*/tests/*,*/vendor/* --extensions=php --report-file="phpcs-error-report.txt" --standard="C:\Users\%USERNAME%\www\~repositories\documentation\coding-standards\PHP\CodeSniffer\CustomPHPCS" . $t for %%a in (phpcs-error-report.txt) do if %%~za GTR 2 (start %%a) else (del %%a)
@doskey fixphp=phpcbf -n -d memory_limit=1G --ignore=*/bootstrap/*,*/config/*,*/framework/*,*/node_modules/*,*/overrides/*,*/tests/*,*/vendor/* --extensions=php --standard="C:\Users\%USERNAME%\www\~repositories\documentation\coding-standards\PHP\CodeSniffer\CustomPHPCS" .
@doskey dump=composer dump-autoload
@doskey db=composer dump-autoload $t php artisan migrate:drop --force $t php artisan migrate --seed
@doskey whereis="C:\Portable Apps\Registry Hacks\whereis.cmd" $*
@doskey atob=powershell "[convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"$*\"))"
@doskey btoa=powershell "[Text.Encoding]::UTF8.GetString([convert]::FromBase64String(\"$*\"))"
@doskey artisan=php artisan $*
@doskey dusk=if exist testing cd testing $t php artisan dusk --without-tty --group mobileApp $*
@doskey prep4dusk=@title ⌛ Development $t cordova prepare -- --dusk $* $t @title %COMSPEC%
@doskey prep=@title ⌛ Production $t cordova prepare --release $* $t @title %COMSPEC%
@doskey hot=cordova run browser -- --live-reload
@doskey fixjs=eslint . --resolve-plugins-relative-to="C:\Users\%USERNAME%\AppData\Roaming\npm\node_modules" --ext .js,.vue,.blade.php --fix
@doskey scanjs=eslint . --resolve-plugins-relative-to="C:\Users\%USERNAME%\AppData\Roaming\npm\node_modules" --ext .js,.vue,.blade.php
@doskey fixsass=stylelint --fix **/*.scss $*
@doskey scansass=stylelint **/*.scss $*
@doskey dic="C:\Users\%USERNAME%\Documents\dictionaries-fix.bat"
@doskey changed=echo off $t (if exist ../laravel cd ..) $t for /F %%i in ('git diff --name-only master...HEAD ^^^| findstr .php') do if exist %%i notepad "%%i" $t echo on $t (if exist .\laravel cd laravel)
@doskey svg=for %%I in (*.svg) do svgo "%%I"
@doskey bash="%ProgramFiles%\Git\git-bash.exe" $t exit
@doskey history=notepad -n999999 filename ""%localappdata%"\clink\.history"
@doskey version=ver
@doskey php81=path=C:\WAMP64\bin\php\php8.1.17;%PATH% $t echo PHP 8.1
@doskey php82=path=C:\WAMP64\bin\php\php8.2.4;%PATH% $t echo PHP 8.2
@doskey wt=wt $t exit
@doskey x=exit
:: UTF-8
chcp 437 >NUL
@doskey weather=powershell -ExecutionPolicy Unrestricted -File "C:\Users\%USERNAME%\Documents\weather.ps1" $* -WindowStyle Hidden
if %isMorning% == true powershell -ExecutionPolicy Unrestricted -File "C:\Users\%USERNAME%\Documents\weather.ps1" morning -WindowStyle Hidden
if %isAfternoon% == true powershell -ExecutionPolicy Unrestricted -File "C:\Users\%USERNAME%\Documents\weather.ps1" afternoon -WindowStyle Hidden
if %isEvening% == true powershell -ExecutionPolicy Unrestricted -File "C:\Users\%USERNAME%\Documents\weather.ps1" evening -WindowStyle Hidden
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"AutoRun"="\"%USERPROFILE%\\Documents\\alias.cmd\""
#####################################
# Consolas+ custom font is required #
#####################################
$u = (Invoke-WebRequest wttr.in/London?uqF`&lang=en -TimeoutSec 5).Content;
$m = (Invoke-WebRequest wttr.in/London?mqF`&lang=en -TimeoutSec 5).Content;
$u = $u.Split([Environment]::NewLine);
$m = $m.Split([Environment]::NewLine);
$is3Day = [bool] $false;
if ($args[0] -eq '3day') {
$is3Day = [bool] $true;
}
if ($is3Day) {
$u[2] = $null;
$u[3] = $null;
$u[4] = $null;
$u[5] = $null;
$u[6] = $null;
} else {
$u[3] = $m[3];
$u[6] = $m[6];
}
$u[12] = $m[12];
$u[15] = $m[15];
$u[22] = $m[22];
$u[25] = $m[25];
$u[32] = $m[32];
$u[35] = $m[35];
if ($is3Day) {
# Remove empty values from array
$u = $u | ? {$_};
}
$u = [system.String]::Join([Environment]::NewLine, $u);
Remove-Variable -name m;
# Change dark blue to pale blue
$u = $u.replace('38;5;21;1m', '38;5;30m');
# Change to green compatible with Windows cmd & Windows Terminal
$u = $u.replace('38;5;046m', '38;5;32m');
$u = $u.replace('38;5;047m', '38;5;32m');
$u = $u.replace('38;5;082m', '38;5;32m');
$u = $u.replace('38;5;111m', '38;5;32m');
$u = $u.replace('38;5;118m', '38;5;32m');
$u = $u.replace('38;5;154m', '38;5;32m');
# Change orange to red
$u = $u.replace('38;5;208m', '38;5;196m');
# Replace diagonal arrows which don't
# exist in the majority of fonts
$u = $u -replace $([char] 0x2196), 'NW';
$u = $u -replace $([char] 0x2197), 'NE';
$u = $u -replace $([char] 0x2198), 'SE';
$u = $u -replace $([char] 0x2199), 'SW';
# Replace lightning bolt emoji
$u = $u -replace $([char] 0x26A1), $([char] 0x21AF + ' ');
# Prevent font ligature when a period follows a (double) hyphen
$u = $u.replace('.--', $('.' + [char] 0x2500 + [char] 0x2500));
$u = $u.replace('.-', $('.' + [char] 0x2500));
# Make the bottom half of a circle more symmetrical
$u = $u.replace($('`-' + [char] 0x2019), $([char] 0x60 + [char] 0x2500 + [char] 0xB4));
# Prepend map marker icon
$u = [char] 0x0020 + [char] 0x00ce + [char] 0x0020 + $u;
if ($is3Day) {
echo `r $u.Substring(0, $u.lastIndexOf($([char] 0x2518)) + 1);
} else {
echo `r $u.Substring(0, $u.indexOf($([char] 0x250c))).trimEnd();
}
@u01jmg3
Copy link
Author

u01jmg3 commented Aug 25, 2017

  • "C:\Portable Apps\AutoHotkey\Includes\Cmd.ahk"&"%USERPROFILE%\Documents\alias.cmd"&"C:\Program Files (x86)\clink\bin\clink.bat" inject --autorun --profile ~\clink
    • Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor 🠖 Autorun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment