mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-10-31 09:22:15 +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:
		
				
					committed by
					
						 Benjamin Staneck
						Benjamin Staneck
					
				
			
			
				
	
			
			
			
						parent
						
							724930d69d
						
					
				
				
					commit
					3bf07c088d
				
			| @@ -1,8 +1,8 @@ | ||||
| @echo off | ||||
|  | ||||
|  | ||||
| if "%aliases%" == "" ( | ||||
|   set ALIASES=%CMDER_ROOT%\config\user-aliases.cmd | ||||
| if "%ALIASES%" == "" ( | ||||
|   set ALIASES="%CMDER_ROOT%\config\user-aliases.cmd" | ||||
| ) | ||||
|  | ||||
| setlocal enabledelayedexpansion | ||||
| @@ -21,7 +21,7 @@ goto parseargument | ||||
|   set currentarg=%~1 | ||||
|  | ||||
|   if /i "%currentarg%" equ "/f" ( | ||||
|     set aliases=%~2 | ||||
|     set ALIASES=%~2 | ||||
|     shift | ||||
|     goto :do_shift | ||||
|   ) else if /i "%currentarg%" == "/reload" ( | ||||
| @@ -50,16 +50,16 @@ goto parseargument | ||||
|   ) | ||||
| rem #endregion parseargument | ||||
|  | ||||
| if "%aliases%" neq "%CMDER_ROOT%\config\user-aliases.cmd" ( | ||||
|   set _x=!_x:/f %aliases% =! | ||||
| if "%ALIASES%" neq "%CMDER_ROOT%\config\user-aliases.cmd" ( | ||||
|   set _x=!_x:/f "%ALIASES%" =! | ||||
|  | ||||
|   if not exist "%aliases%" ( | ||||
|     echo ;= @echo off>"%aliases%" | ||||
|     echo ;= rem Call DOSKEY and use this file as the macrofile>>"%aliases%" | ||||
|     echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%aliases%" | ||||
|     echo ;= rem In batch mode, jump to the end of the file>>"%aliases%" | ||||
|     echo ;= goto:eof>>"%aliases%" | ||||
|     echo ;= Add aliases below here>>"%aliases%" | ||||
|   if not exist "%ALIASES%" ( | ||||
|     echo ;= @echo off>"%ALIASES%" | ||||
|     echo ;= rem Call DOSKEY and use this file as the macrofile>>"%ALIASES%" | ||||
|     echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%ALIASES%" | ||||
|     echo ;= rem In batch mode, jump to the end of the file>>"%ALIASES%" | ||||
|     echo ;= goto:eof>>"%ALIASES%" | ||||
|     echo ;= Add aliases below here>>"%ALIASES%" | ||||
|   ) | ||||
| ) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user