I want to find whether a certain DLL is available on the system path. in Powershell, I can use get-command myfile.dll
, and in cmd I can use where myfile.dll
.
How can I do that in C#? Do I have to manually parse Environment.GetEnvironmentVariable("path")
, or is there a better way?
Not sure about where
, but Get-Command
internally resolves the file location using the following algorithm (overly simplified):
Environment.GetEnvironmentVariable("PATH")
PATH
entry with Directory.EnumerateFiles()