- Jun
- 762
- 16
I don't understand what is happening here.
TCC(27.01.23): C:\>alias cd_leave
echo `%1=`%1 & set oldcwd=%1 & echo oldcwd=%oldcwd
TCC(27.01.23): C:\>cd temp
%1=C:\
oldcwd=C:\ C:\temp
TCC(27.01.23): C:\temp>
It is acting as though I had written "set oldcwd=%1 %2" as the middle command of the three. If I change the alias to
echo `%1=`%1, `%2=`%2 & set oldcwd=%1 & echo oldcwd=%oldcwd
then things work.
TCC(27.01.23): C:\>alias cd_leave
echo `%1=`%1, `%2=`%2 & set oldcwd=%1 & echo oldcwd=%oldcwd
TCC(27.01.23): C:\>temp\
%1=C:\, %2=C:\temp
oldcwd=C:\
TCC(27.01.23): C:\temp>
TCC(27.01.23): C:\>alias cd_leave
echo `%1=`%1 & set oldcwd=%1 & echo oldcwd=%oldcwd
TCC(27.01.23): C:\>cd temp
%1=C:\
oldcwd=C:\ C:\temp
TCC(27.01.23): C:\temp>
It is acting as though I had written "set oldcwd=%1 %2" as the middle command of the three. If I change the alias to
echo `%1=`%1, `%2=`%2 & set oldcwd=%1 & echo oldcwd=%oldcwd
then things work.
TCC(27.01.23): C:\>alias cd_leave
echo `%1=`%1, `%2=`%2 & set oldcwd=%1 & echo oldcwd=%oldcwd
TCC(27.01.23): C:\>temp\
%1=C:\, %2=C:\temp
oldcwd=C:\
TCC(27.01.23): C:\temp>