mirror of
https://github.com/cmderdev/cmder.git
synced 2025-03-13 06:04:36 +08:00
Fix alias.bat handling "user-aliases.cmd" with spaces (#1531)
* Fix alias.bat handling "user-aliases.cmd" with spaces This fixes the alias command when user-aliases.cmd is located in a path with spaces (like when Cmder is installed into the program-files directory). I've also made the alphabetical case of the ALIASES variable consistent. * address review comments
This commit is contained in:
parent
724930d69d
commit
3bf07c088d
@ -1,8 +1,8 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
if "%aliases%" == "" (
|
if "%ALIASES%" == "" (
|
||||||
set ALIASES=%CMDER_ROOT%\config\user-aliases.cmd
|
set ALIASES="%CMDER_ROOT%\config\user-aliases.cmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
@ -21,7 +21,7 @@ goto parseargument
|
|||||||
set currentarg=%~1
|
set currentarg=%~1
|
||||||
|
|
||||||
if /i "%currentarg%" equ "/f" (
|
if /i "%currentarg%" equ "/f" (
|
||||||
set aliases=%~2
|
set ALIASES=%~2
|
||||||
shift
|
shift
|
||||||
goto :do_shift
|
goto :do_shift
|
||||||
) else if /i "%currentarg%" == "/reload" (
|
) else if /i "%currentarg%" == "/reload" (
|
||||||
@ -50,16 +50,16 @@ goto parseargument
|
|||||||
)
|
)
|
||||||
rem #endregion parseargument
|
rem #endregion parseargument
|
||||||
|
|
||||||
if "%aliases%" neq "%CMDER_ROOT%\config\user-aliases.cmd" (
|
if "%ALIASES%" neq "%CMDER_ROOT%\config\user-aliases.cmd" (
|
||||||
set _x=!_x:/f %aliases% =!
|
set _x=!_x:/f "%ALIASES%" =!
|
||||||
|
|
||||||
if not exist "%aliases%" (
|
if not exist "%ALIASES%" (
|
||||||
echo ;= @echo off>"%aliases%"
|
echo ;= @echo off>"%ALIASES%"
|
||||||
echo ;= rem Call DOSKEY and use this file as the macrofile>>"%aliases%"
|
echo ;= rem Call DOSKEY and use this file as the macrofile>>"%ALIASES%"
|
||||||
echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%aliases%"
|
echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%ALIASES%"
|
||||||
echo ;= rem In batch mode, jump to the end of the file>>"%aliases%"
|
echo ;= rem In batch mode, jump to the end of the file>>"%ALIASES%"
|
||||||
echo ;= goto:eof>>"%aliases%"
|
echo ;= goto:eof>>"%ALIASES%"
|
||||||
echo ;= Add aliases below here>>"%aliases%"
|
echo ;= Add aliases below here>>"%ALIASES%"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -110,11 +110,11 @@ exit /b
|
|||||||
|
|
||||||
:p_help
|
:p_help
|
||||||
echo.Usage:
|
echo.Usage:
|
||||||
echo.
|
echo.
|
||||||
echo. alias [options] [alias=full command]
|
echo. alias [options] [alias=full command]
|
||||||
echo.
|
echo.
|
||||||
echo.Options:
|
echo.Options:
|
||||||
echo.
|
echo.
|
||||||
echo. /d [alias] Delete an [alias].
|
echo. /d [alias] Delete an [alias].
|
||||||
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
|
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
|
||||||
echo. Default: %cmder_root%\config\user-aliases.cmd
|
echo. Default: %cmder_root%\config\user-aliases.cmd
|
||||||
|
Loading…
x
Reference in New Issue
Block a user