The ‘which’ tool from unix had long been a small but useful part of my command line toolbox. For years now I’ve used the cygwin implementation when I needed to find out where the executable I was running lived.
The cygwin implementation isn’t ideal for use on windows as cygwin has its own approach to drive letters and simulates a unix style environment.
I’ve been working with C# quite a bit lately (and rather enjoying working with the language) and decided to put together some tools in C# that would streamline things.
I had a few hours between things over the last few days and put together the initial form of a more windows-y which written in C#. The current, partial version is on my github as C9Which.
I expect this to acquire more commmand line switches to control its behavior and a bit more polish in terms of what it looks for.
Currently it takes the full name of the file and returns all hits on the path in order with the first item being the one that would run if you typed the name on the command line. It also gripes about folders that are present in the path that don’t correspond to actual folders in the filesystem.
I expect to keep these features but likely hide them behind command line switches. I’m looking at command line switch processing library code out there and there seems to be a somewhat standard library shared by Microsoft called CommmandLineUtils that looks promising. I’ll likely try using that one and see where it gets me.