Skip to content

Instantly share code, notes, and snippets.

@gimmi
Last active September 7, 2023 12:49
Show Gist options
  • Save gimmi/6079390 to your computer and use it in GitHub Desktop.
Save gimmi/6079390 to your computer and use it in GitHub Desktop.
Settings for CMD and PowerShell
@ECHO OFF
REM HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun => "%USERPROFILE%\cmdrc.cmd"
doskey subl="%ProgramFiles%\Sublime Text 3\subl.exe" $*
doskey ls=dir /O:GN /D $*
doskey x="%windir%\explorer.exe" .
doskey cdh=CD "%USERPROFILE%"
doskey cdt=CD "%USERPROFILE%\Temp"
doskey gitex="%ProgramFiles(x86)%\GitExtensions\gitex.cmd"
doskey mvn="%USERPROFILE%\Tools\apache-maven\bin\mvn" $*
doskey ant="%USERPROFILE%\Tools\apache-ant\bin\ant" $*
doskey sqlcmd="%ProgramFiles%\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\sqlcmd.exe" $*
doskey ssh="%ProgramFiles%\Git\usr\bin\ssh" $*
doskey gpg="%ProgramFiles%\Git\usr\bin\gpg" $*
doskey msbuild="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" $*
# Edit profile with the following command
# notepad $PROFILE
function prompt {
$Location = Get-Location
Write-Host -Object $Location.Path -ForegroundColor DarkGray
'>' * $NestedPromptLevel + '> '
}
Invoke-Command -ScriptBlock {
Write-Host " User: " -ForegroundColor DarkGray -NoNewline
$WindowsIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
Write-Host -Object $WindowsIdentity.Name
Write-Host "Admin: " -ForegroundColor DarkGray -NoNewline
# See https://blogs.technet.microsoft.com/undocumentedfeatures/2016/11/28/checking-for-an-elevated-powershell-prompt/
$WindowsIdentity = [System.Security.Principal.Windowsidentity]::GetCurrent()
$WindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($WindowsIdentity)
$AdministratorRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator
Write-Host -Object $WindowsPrincipal.IsInRole($AdministratorRole)
}
Remove-Item Alias:\curl # This way, C:\Windows\system32\curl.exe will take precedence
Set-Alias -Name x -Value "$env:windir\explorer.exe" -Option Constant
Set-Alias -Name subl -Value "$env:Programfiles\Sublime Text\subl.exe" -Option Constant
Set-Alias -Name rider -Value "$env:Programfiles\JetBrains\JetBrains Rider 2022.2.2\bin\rider64.exe" -Option Constant
Set-Alias -Name gitex -Value "${env:ProgramFiles(x86)}\GitExtensions\gitex.cmd" -Option Constant
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols": 160,
"initialRows": 50,
"multiLinePasteWarning": false,
"profiles":
{
"defaults": {
// Put settings here that you want to apply to all profiles
"colorScheme": "Campbell",
"fontFace": "JetBrains Mono",
// Copy this: https://forum.level1techs.com/t/man-do-i-love-the-new-windows-terminal/146087
// here: %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState
"backgroundImage" : "ms-appdata:///roaming/lowps.png",
"backgroundImageOpacity" : 0.5
},
"list": [{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"startingDirectory" : "."
},{
// cmd
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd"
}, {
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"name": "Azure Cloud Shell",
"hidden": false,
"source": "Windows.Terminal.Azure"
}, {
"guid": "{4334fd4c-3939-49c2-ae7f-3a1d0c361a20}",
"commandline" : "\"%PROGRAMFILES%\\git\\usr\\bin\\bash.exe\" -i -l",
"icon" : "%PROGRAMFILES%\\Git\\mingw64\\share\\git\\git-for-windows.ico",
"name" : "Git Bash",
"startingDirectory" : "%USERPROFILE%"
}]
},
// Add custom color schemes to this array
"schemes": [],
// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment