Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows VistaWindows XPWindows MeWindows 98Windows 95Virtual PCInternet ExplorerOutlook ExpressWindows MediaSecurity
Related Topics
MS Server ProductsMS OfficePC HardwareMore Topics ...

Windows Forum / Windows XP / General Topics 1 / May 2008

Tip: Looking for answers? Try searching our database.

cmd equivalent of linux 'which' command

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin O - 12 Feb 2007 17:41 GMT
Hi All,
Does anyone know of a DOS or cmd.exe equivalent to the Linux 'which'
command. On Linux, 'which' gives me the full path of an executable. So for
example, if I have multiple versions of java.exe, running 'which java.exe'
gives me the full path of the one that will run based on PATH settings.
Thanks.
nass - 12 Feb 2007 17:58 GMT
> Hi All,
> Does anyone know of a DOS or cmd.exe equivalent to the Linux 'which'
> command. On Linux, 'which' gives me the full path of an executable. So for
> example, if I have multiple versions of java.exe, running 'which java.exe'
> gives me the full path of the one that will run based on PATH settings.
> Thanks.

Although this MS NG but here it goes:
Use the Bash command (is the default command in linux);
builtin  = for the built-in shell
bash = run the bash shell
ksh = run the korn shell
sh = run the bourne shell
csh = run the c shell which is /C

also the /bin command
sudo  to install an application.

Here is a link will explain for you more:
www.yolinux.com/TUTORIALS/unix_for_dos_users.html

HTH.
nass
Gordon - 12 Feb 2007 18:09 GMT
>> Hi All,
>> Does anyone know of a DOS or cmd.exe equivalent to the Linux 'which'
[quoted text clipped - 7 lines]
> Although this MS NG but here it goes:
> Use the Bash command (is the default command in linux);

The OP is asking for a Windows equivalent.......
nass - 12 Feb 2007 18:19 GMT
> >> Hi All,
> >> Does anyone know of a DOS or cmd.exe equivalent to the Linux 'which'
[quoted text clipped - 9 lines]
>
> The OP is asking for a Windows equivalent.......

Hmm,Well the link Provide both if you did read.
Jim - 12 Feb 2007 18:41 GMT
>> >> Hi All,
>> >> Does anyone know of a DOS or cmd.exe equivalent to the Linux 'which'
[quoted text clipped - 12 lines]
>
> Hmm,Well the link Provide both if you did read.
Yes indeed.  A more direct answer is "set path".  As it is documented, this
command displays the contents of the Path environment variable.
The program in question is somewhere in one of the folders in the Path.
Jim
Martin O - 12 Feb 2007 19:10 GMT
Thanks for the replies guys.

I checked that link nass. I couldnt find anything about an equivalent to the
linux 'which' command. There is another variation of this command on other
flavors of unix...I think its 'file' if I remember correctly. I found
mentions of a dos command 'truename' I think it was. But this is not in XP.

Thanks for pointing out that I can view the contents of the PATH variable
Jim. I suppose if I had to, I could check each folder in my path for the
executable I'm looking for, then I could assume that the OS is executing the
first one I found. I was actually hoping for something easy like the linux
'which' command though. For example, in linux, if I have different java
executables, I could quickly find out which one runs when I type just 'java'
by entering the command 'which java'. The result would be something like
'/usr/bin/java'. It would take into acount what my current directory is, and
the path, and give me *exactly which* java it would run. Useful for
sanity-checks.

At any rate, I've found a solution I should have thought of before: cygwin.
But I'd still be interested in finding out if theres an 'xp command line' way.

Thanks again.

> >> >> Hi All,
> >> >> Does anyone know of a DOS or cmd.exe equivalent to the Linux 'which'
[quoted text clipped - 16 lines]
> The program in question is somewhere in one of the folders in the Path.
> Jim
Rob.cpp.vb.java - 13 May 2008 22:35 GMT
I found this site, that has several ports of the "which" command
'UNIX ports - WHICH' (http://www.robvanderwoude.com/which.html

I've used the batch file, which seems to work fine

HT

Ro

--
Rob.cpp.vb.java
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.