Skip to content

Commit

Permalink
Merge pull request #313 from glucas/unalias-command
Browse files Browse the repository at this point in the history
Add an unalias command
  • Loading branch information
MartiUK committed Nov 11, 2014
2 parents 25991ac + 79fbae0 commit b700016
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions bin/unalias.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@echo off
if ["%1"] == ["/?"] goto:p_help
if ["%1"] == [""] echo Insufficient parameters. & goto:p_help

setlocal

:: Check if alias exists
doskey /macros | findstr /b %1= >NUL || goto :p_not_found

:: Remove alias from current shell
doskey %1=

:: Remove alias from aliases file
copy /y "%CMDER_ROOT%\config\aliases" "%TEMP%\aliases.prev" >NUL
type "%TEMP%\aliases.prev" | findstr /b /v %1= > "%CMDER_ROOT%\config\aliases"
echo Alias removed

endlocal
goto:eof

:p_not_found
echo Alias not defined.
goto:eof

:p_help
echo.Usage:
echo. unalias name
echo. For more information, read DOSKEY/?

0 comments on commit b700016

Please sign in to comment.