Hey there as per title, when I try in cmder prompt to create an alias with an equal sign, what comes with the =
gets truncated and not correctly stored in the user-aliases.cmd
file.
For ex:
λ alias wifi=netsh wlan show profile $1 key=clear
will be stored as:
wifi=netsh wlan show profile $1 ke
I guess for $reasons
cmder reads y=clear
as $something
worthy evaluating and so it's cut off from the actual alias storing process. Manually editing the file quickly overcome this issue.
Am I blatantly missing something on the ever growing Effin' Manual that I haven't accurately read? 😛
It looks like the doskey command (which alias wraps) handles your example, so this may be a bug in the alias.bat script.
You can debug by modifying alias.bat and changing the first line to @echo on
. Looking at it now, I see that there is a point where the script splits the alias string using "=" as a delimiter, and assumes that there will only be one = in the string.
Here's a fix: in alias.bat, find the linethat says ":: validate alias" and in the following line replace the '2' with a '*', like so:
for /f "delims== tokens=1,* usebackq" %%G in (echo "%_x%"
) do (
This seems to work for me with your example.
Thank you for explaining in detail the issue at hand, very useful for me as I'm a novice in CMD stuff! :)
I can confirm your correction fixed the problem, thank you! Should I do a PR?
I can create a pull request with the fix. Thanks for confirming that it works for you.
Most helpful comment
It looks like the doskey command (which alias wraps) handles your example, so this may be a bug in the alias.bat script.
You can debug by modifying alias.bat and changing the first line to
@echo on
. Looking at it now, I see that there is a point where the script splits the alias string using "=" as a delimiter, and assumes that there will only be one = in the string.Here's a fix: in alias.bat, find the linethat says ":: validate alias" and in the following line replace the '2' with a '*', like so:
for /f "delims== tokens=1,* usebackq" %%G in (
echo "%_x%"
) do (This seems to work for me with your example.