\(\left(x-1\right)^{x+2}=\left(x-1\right)^{x+4}\\ \Leftrightarrow\left(x-1\right)^{x+4}-\left(x-1\right)^{x+2}=0\\ \Leftrightarrow\left(x-1\right)^{x+2}\left[\left(x-1\right)^2-1\right]=0\\\Leftrightarrow x\left(x-1\right)^{x+2}\left(x-2\right)\\ \Rightarrow\left[{}\begin{matrix}x=0\\x=1\\x=2\end{matrix}\right.\)