Solved

windows equivalent to "which" command on unix

Posted on 2004-11-02
1,460 Views
Last Modified: 2006-11-17
Is there a windows equivalent command to "which" command on unix.

I am trying to get the full path of the executable that is used, when I just run a exe from cmd prompt.

If there is no command, Is there an solution to achieve that?

Thanks!
0
Question by:chennarh
    5 Comments
     
    LVL 57

    Expert Comment

    by:PeteLong
    confused do you mean

    echo %path%
    0
     

    Author Comment

    by:chennarh
    nope,
    Say I have a test.exe in 10 different directories, and all of them are included in my path, and I open up a command prompt and type "test", I want to know which one of those 10 files is being executed.
    0
     
    LVL 82

    Accepted Solution

    by:
    Download the GNU utilities for Windows; it contains a "which".
    GNU utilities for Win32
    http://unxutils.sourceforge.net/

    A single line in a batch will work as well:

    ====8<----[which.cmd]----
    @echo %~$PATH:1
    ====8<----[which.cmd]----
    0
     
    LVL 6

    Expert Comment

    by:nihlcat
    Not sure I understand.  Are you trying to type a command without the full path?  Then hold down the Windows key and press the "F" key.  Find the directory of the .exe, and add it to your path:

    1. Right click on my computer, select properties
    2. Click on the Advanced Tab
    3. Choose Environment Variables.
    4. Add to the end of System or User Variables.

    I have NO idea if I am answering the right question! :)
    0
     

    Author Comment

    by:chennarh
    Thanks oBdA.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Product Review - Android Remix

    Come along for the ride with our Senior Product Manager, Brian Matis, as he reviews the Android Remix.

    As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
    This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.
    This video discusses moving either the default database or any database to a new volume.

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now