For the integrand $\frac{\cos(1/x)}{x^2}$, substitute $u = \frac1 x$ and $\def\d{\,\mathrm{d}} \d u = -\frac1{x^2}\d x$.
This gives a new lower bound $u = \frac1{1/\pi} = \pi$ and upper bound $u = \frac1{2/\pi} = \frac{\pi}{2}$. Now, our integral becomes:
$I= - \int\limits_\pi^{\pi/2} \cos(u) \d u$
$\;\;= \int\limits_{\pi/2}^\pi \cos(u)\d u$
Since the antiderivative of $\cos(u)$ is $\sin(u)$, applying the fundamental theorem of calculus, we get:
$I= \sin(u)\;\mid _{\pi/2}^\pi$
$\;\;= \sin(\pi) - \sin \left ( \frac\pi 2\right )$
$\;\;= 0 - 1$
$\;\; = {-1}$