Advertisement
Guest User

Untitled

a guest
May 4th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. var path = "perl";
  2. var found = Environment.GetEnvironmentVariable("PATH").Split(';')
  3. .Select(x => Path.Combine(x, path))
  4. .SelectMany(_ => Environment.GetEnvironmentVariable("PATHEXT").Split(';')
  5. .Concat(new String[] { Path.GetExtension(path) }),
  6. (p, ext) => Path.ChangeExtension(p, ext))
  7. .Where(File.Exists).FirstOrDefault();
  8. // found => "c:\cygwin\bin\perl.EXE"(インストール済みの場合)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement