cmder/Cmder.bat

67 lines
2.7 KiB
Batchfile
Raw Normal View History

2013-12-25 03:45:43 +08:00
@echo off
2023-09-25 23:14:54 +08:00
2013-12-25 03:45:43 +08:00
SET CMDER_ROOT=%~dp0
2023-11-23 20:20:26 +08:00
set CMDER_TERMINAL=conemu
2023-09-25 23:14:54 +08:00
if exist "%CMDER_ROOT%\vendor\windows-terminal\windowsterminal.exe" (
SET CMDER_TERMINAL=windows-terminal
2022-09-01 21:00:43 +08:00
)
2023-09-25 23:14:54 +08:00
if NOT "%~1" == "" (
SET CMDER_TERMINAL=%~1
shift
2015-11-15 02:15:42 +08:00
)
2023-09-25 23:14:54 +08:00
:: Remove Trailing '\'
if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1%
if not exist "%CMDER_ROOT%\config" md "%CMDER_ROOT%\config" 2>nul
call :%CMDER_TERMINAL%
exit /b
:conemu
if not exist "%CMDER_ROOT%\config\user_ConEmu.xml" (
copy "%CMDER_ROOT%\vendor\ConEmu.xml.default" "%CMDER_ROOT%\config\user_ConEmu.xml" 1>nul
if %errorlevel% neq 0 (
echo ERROR: CMDER Initialization has Failed
exit /b 1
)
)
2023-11-11 09:57:46 +08:00
2023-09-25 23:14:54 +08:00
if exist "%~1" (
start %cmder_root%\vendor\conemu-maximus5\ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%~1"
) else (
start %cmder_root%\vendor\conemu-maximus5\ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\user_ConEmu.xml"
)
exit /b
:windows-terminal
if not exist "%CMDER_ROOT%\vendor\windows-terminal\settings" md "%CMDER_ROOT%\vendor\windows-terminal\settings" 2>nul
2023-09-26 23:24:34 +08:00
if not exist "%CMDER_ROOT%\vendor\windows-terminal\.portable" echo "This makes this installation of Windows Terminal portable" >"%CMDER_ROOT%\vendor\windows-terminal\.portable" 2>nul
2023-09-25 23:14:54 +08:00
if exist "%CMDER_ROOT%\config\user_windows_terminal_settings.json" (
if not exist "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" (
echo "Copying user Windows Terminal settings to '%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json'..."
copy "%CMDER_ROOT%\config\user_windows_terminal_settings.json" "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" 1>nul
)
) else if not exist "%CMDER_ROOT%\config\user_windows_terminal_settings.json" (
if not exist "%CMDER_ROOT%\config" mkdir "%CMDER_ROOT%\config" 2>nul
echo "Copying default Windows Terminal settings to '%CMDER_ROOT%\config'..."
copy "%CMDER_ROOT%\vendor\windows_terminal_default_settings.json" "%CMDER_ROOT%\config\user_windows_terminal_settings.json" 1>nul
echo "Copying default Windows Terminal settings to '%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json'..."
copy "%CMDER_ROOT%\vendor\windows_terminal_default_settings.json" "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" 1>nul
if %errorlevel% neq 0 (
echo ERROR: CMDER Initialization has Failed
exit /b 1
)
) else if exist "%cmder_root%\vendor\windows-terminal\settings\settings.json" (
copy "%cmder_root%\vendor\windows-terminal\settings\settings.json" "%CMDER_ROOT%\config\user_windows_terminal_settings.json"
)
start %cmder_root%\vendor\windows-terminal\windowsterminal.exe
exit /b