Popular recipes tagged "which"http://code.activestate.com/recipes/tags/which/2015-03-20T19:23:45-07:00ActiveState Code RecipesA UNIX-like "which" command for Python (Python)
2015-03-20T19:23:45-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579035-a-unix-like-which-command-for-python/
<p style="color: grey">
Python
recipe 579035
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/commands/">commands</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/unix/">unix</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/which/">which</a>).
</p>
<p>UNIX users are familiar with the which command. Given an argument called name, it checks the system PATH environment variable, to see whether that name exists (as a file) in any of the directories specified in the PATH. (The directories in the PATH are colon-separated on UNIX and semicolon-separated on Windows.)</p>
<p>This recipe shows how to write a minimal which command in Python.
It has been tested on Windows.</p>
'Which' for Windows (Python)
2013-08-16T09:14:07-07:00Robert Pyronhttp://code.activestate.com/recipes/users/4174781/http://code.activestate.com/recipes/578642-which-for-windows/
<p style="color: grey">
Python
recipe 578642
by <a href="/recipes/users/4174781/">Robert Pyron</a>
(<a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/utility/">utility</a>, <a href="/recipes/tags/which/">which</a>, <a href="/recipes/tags/windows/">windows</a>).
Revision 2.
</p>
<p>WHICH.PY scans through all directories specified in the system %PATH%
environment variable, looking for the specified COMMAND(s). It tries
to follow the sometimes bizarre rules for Windows command lookup.</p>
Prints full name of all occurrences of given filename in your PATH (Python)
2009-06-29T15:20:10-07:00Ben Hoythttp://code.activestate.com/recipes/users/4170919/http://code.activestate.com/recipes/576823-prints-full-name-of-all-occurrences-of-given-filen/
<p style="color: grey">
Python
recipe 576823
by <a href="/recipes/users/4170919/">Ben Hoyt</a>
(<a href="/recipes/tags/filename/">filename</a>, <a href="/recipes/tags/find/">find</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/which/">which</a>).
</p>
<p>Simple program to print the full name of all occurrences of the given filename in your PATH. Kind of like the Unix "which" utility, but works for DLLs and other files as well.</p>
<p>Usage: findinpath.py filename</p>