windows equivalent to "which" command on unix

Posted on 2004-11-02
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?

Question by:chennarh
    LVL 57

    Expert Comment

    confused do you mean

    echo %path%

    Author Comment

    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.
    LVL 82

    Accepted Solution

    Download the GNU utilities for Windows; it contains a "which".
    GNU utilities for Win32

    A single line in a batch will work as well:

    @echo %~$PATH:1
    LVL 6

    Expert Comment

    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! :)

    Author Comment

    Thanks oBdA.

    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, ( 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 ( This reminded me of questions tha…
    This video is in connection to the article "The case of a missing mobile phone (". 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