File tree Expand file tree Collapse file tree 2 files changed +41
-5
lines changed
Expand file tree Collapse file tree 2 files changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,13 @@ $env:PSModulePath = (Join-Path $SHELL_ROOT "vendor\modules") + ";" + $env:PSModu
1414# Configure console to use Nerd Font (CaskaydiaCove NF)
1515# This is required for Oh My Posh icons and glyphs to display correctly
1616try {
17- # Set console font to CaskaydiaCove NF
18- $Host.UI.RawUI.WindowTitle = " Bearsampp PowerShell Console"
17+ # Only set default title if one hasn't been set already
18+ # This allows the launcher to set custom titles per console type
19+ if ($Host.UI.RawUI.WindowTitle -eq " Administrator: C:\WINDOWS\system32\cmd.exe" -or
20+ $Host.UI.RawUI.WindowTitle -eq " C:\WINDOWS\system32\cmd.exe" -or
21+ $Host.UI.RawUI.WindowTitle -match " pwsh\.exe" ) {
22+ $Host.UI.RawUI.WindowTitle = " Bearsampp PowerShell Console"
23+ }
1924
2025 # Note: Font configuration is typically set in Windows Terminal settings.json
2126 # or via registry for Windows Console Host. The font should be installed system-wide.
Original file line number Diff line number Diff line change 11@ echo off
22REM Bearsampp PowerShell Launcher
33REM This script launches PowerShell with the custom Bearsampp profile
4+ REM
5+ REM Usage: powershell.bat [--title "Title"] [--startingDirectory "Path"]
6+ REM --title - Optional: Window title
7+ REM --startingDirectory - Optional: Starting directory
48
5- setlocal
9+ setlocal EnableDelayedExpansion
610
711REM Get the directory where this script is located
812set " SHELL_ROOT = %~dp0 "
@@ -11,7 +15,34 @@ set "SHELL_ROOT=%SHELL_ROOT:~0,-1%"
1115REM Set the custom profile path
1216set " CUSTOM_PROFILE = %SHELL_ROOT% \config\Microsoft.PowerShell_profile.ps1"
1317
14- REM Launch PowerShell with custom profile using dot-sourcing
15- " %SHELL_ROOT% \pwsh.exe" -NoExit -NoProfile -Command " . '%CUSTOM_PROFILE% '"
18+ REM Default values
19+ set " WINDOW_TITLE = Bearsampp PowerShell Console"
20+ set " START_DIR = %CD% "
21+
22+ REM Parse command line arguments
23+ :parse_args
24+ if " %~1 " == " " goto end_parse
25+ if /i " %~1 " == " --title" (
26+ set " WINDOW_TITLE = %~2 "
27+ shift
28+ shift
29+ goto parse_args
30+ )
31+ if /i " %~1 " == " --startingDirectory" (
32+ set " START_DIR = %~2 "
33+ shift
34+ shift
35+ goto parse_args
36+ )
37+ shift
38+ goto parse_args
39+ :end_parse
40+
41+ REM Build the PowerShell command
42+ set " PS_COMMAND = $Host.UI.RawUI.WindowTitle='!WINDOW_TITLE! '; Set-Location '!START_DIR! '; . '!CUSTOM_PROFILE! '"
43+
44+ REM Launch PowerShell with custom profile and parameters
45+ " %SHELL_ROOT% \pwsh.exe" -NoExit -NoProfile -Command " !PS_COMMAND! "
1646
1747endlocal
48+ ====== =
You can’t perform that action at this time.
0 commit comments