Sounds like, at best, a great way to find obsolete copies of nvidia-smi.exe shipped with installed but inactive driver versions.
On all my Windows/Nvidia systems, the current version of nvidia-smi.exe is present in %SystemRoot%\System32.
OTOH, …\FileRepository*\nvidia-smi.exe matches anywhere from one to eight versions, dating back to 2023.
Perhaps this is only true because I use official Nvidia mechanisms (.exe installer from Nvidia Web site or Nvidia-supplied app) to install drivers, rather than Windows Update or INF install?
Incidentally, the wildcard …\FileRepository\nvdm* suggested in the Stack Overflow answer returns zero directories on my systems, as all Nvidia driver repository directories start with either nv_dispi (GeForce) or nv_dispwi (workstation).
Which makes sense, because obviously the INF file name used to generate these directory names is subject to change without notice.
In any case, per "nvidia-smi --help":
Note that the functionality of NVSMI is exposed through the NVML C-based
library. See the NVIDIA developer website for more information about NVML.
Python wrappers to NVML are also available. The output of NVSMI is
not guaranteed to be backwards compatible; NVML and the bindings are backwards
compatible.
http://developer.nvidia.com/nvidia-management-library-nvml/
http://pypi.python.org/pypi/nvidia-ml-py/