How do I find the location of an executable in Windows?











up vote
108
down vote

favorite
29












I remembered that I used a tool called as where to find locations for any executable programs like this in a console:



 C:TmpWhere myTool.exe
C:Program FilesMyAppmyTools.exe
....


Now I cannot find this tool. Not sure if Windows has a build-in tool to do that search?










share|improve this question




















  • 1




    Various answers over on Is there an equivalent of 'which' on windows? - Stack Overflow
    – Satanicpuppy
    Sep 30 '09 at 17:17












  • IF the application is running & you need to know its location, use Process Explorer( from Sys Internals).
    – Ganesh R.
    Sep 30 '09 at 17:19






  • 5




    where worked for me on Windows 7 Enterprise
    – Bohemian
    May 29 '14 at 3:09






  • 3




    PAGING OP: Please update accepted answer :)
    – Jake
    Sep 19 '16 at 3:01










  • @David.Chu.ca please update accepted answer
    – Matt Frear
    Aug 10 at 9:09















up vote
108
down vote

favorite
29












I remembered that I used a tool called as where to find locations for any executable programs like this in a console:



 C:TmpWhere myTool.exe
C:Program FilesMyAppmyTools.exe
....


Now I cannot find this tool. Not sure if Windows has a build-in tool to do that search?










share|improve this question




















  • 1




    Various answers over on Is there an equivalent of 'which' on windows? - Stack Overflow
    – Satanicpuppy
    Sep 30 '09 at 17:17












  • IF the application is running & you need to know its location, use Process Explorer( from Sys Internals).
    – Ganesh R.
    Sep 30 '09 at 17:19






  • 5




    where worked for me on Windows 7 Enterprise
    – Bohemian
    May 29 '14 at 3:09






  • 3




    PAGING OP: Please update accepted answer :)
    – Jake
    Sep 19 '16 at 3:01










  • @David.Chu.ca please update accepted answer
    – Matt Frear
    Aug 10 at 9:09













up vote
108
down vote

favorite
29









up vote
108
down vote

favorite
29






29





I remembered that I used a tool called as where to find locations for any executable programs like this in a console:



 C:TmpWhere myTool.exe
C:Program FilesMyAppmyTools.exe
....


Now I cannot find this tool. Not sure if Windows has a build-in tool to do that search?










share|improve this question















I remembered that I used a tool called as where to find locations for any executable programs like this in a console:



 C:TmpWhere myTool.exe
C:Program FilesMyAppmyTools.exe
....


Now I cannot find this tool. Not sure if Windows has a build-in tool to do that search?







windows






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 3 '14 at 18:31









Cfinley

1,43331120




1,43331120










asked Sep 30 '09 at 17:06









David.Chu.ca

1,19672236




1,19672236








  • 1




    Various answers over on Is there an equivalent of 'which' on windows? - Stack Overflow
    – Satanicpuppy
    Sep 30 '09 at 17:17












  • IF the application is running & you need to know its location, use Process Explorer( from Sys Internals).
    – Ganesh R.
    Sep 30 '09 at 17:19






  • 5




    where worked for me on Windows 7 Enterprise
    – Bohemian
    May 29 '14 at 3:09






  • 3




    PAGING OP: Please update accepted answer :)
    – Jake
    Sep 19 '16 at 3:01










  • @David.Chu.ca please update accepted answer
    – Matt Frear
    Aug 10 at 9:09














  • 1




    Various answers over on Is there an equivalent of 'which' on windows? - Stack Overflow
    – Satanicpuppy
    Sep 30 '09 at 17:17












  • IF the application is running & you need to know its location, use Process Explorer( from Sys Internals).
    – Ganesh R.
    Sep 30 '09 at 17:19






  • 5




    where worked for me on Windows 7 Enterprise
    – Bohemian
    May 29 '14 at 3:09






  • 3




    PAGING OP: Please update accepted answer :)
    – Jake
    Sep 19 '16 at 3:01










  • @David.Chu.ca please update accepted answer
    – Matt Frear
    Aug 10 at 9:09








1




1




Various answers over on Is there an equivalent of 'which' on windows? - Stack Overflow
– Satanicpuppy
Sep 30 '09 at 17:17






Various answers over on Is there an equivalent of 'which' on windows? - Stack Overflow
– Satanicpuppy
Sep 30 '09 at 17:17














IF the application is running & you need to know its location, use Process Explorer( from Sys Internals).
– Ganesh R.
Sep 30 '09 at 17:19




IF the application is running & you need to know its location, use Process Explorer( from Sys Internals).
– Ganesh R.
Sep 30 '09 at 17:19




5




5




where worked for me on Windows 7 Enterprise
– Bohemian
May 29 '14 at 3:09




where worked for me on Windows 7 Enterprise
– Bohemian
May 29 '14 at 3:09




3




3




PAGING OP: Please update accepted answer :)
– Jake
Sep 19 '16 at 3:01




PAGING OP: Please update accepted answer :)
– Jake
Sep 19 '16 at 3:01












@David.Chu.ca please update accepted answer
– Matt Frear
Aug 10 at 9:09




@David.Chu.ca please update accepted answer
– Matt Frear
Aug 10 at 9:09










10 Answers
10






active

oldest

votes

















up vote
6
down vote



accepted










I think you may be thinking of the which command in Linux.



$ which bash
/bin/bash


I'm not aware of an equivalent tool in Windows.



EDIT: I just remembered that there's a package called Unix Utils for Windows that would provide this functionality for you.






share|improve this answer





















  • github.com/bmatzelle/gow/wiki is a descendant of Unix Utils that is more convenient to use, called Gnu on Windows. It has more utilities and an installer.
    – Simon D
    Jul 25 '12 at 6:38






  • 27




    Dammit I can't downvote. The OP was right and there is a "where.exe". See the answer below here: superuser.com/a/440904/59929
    – Piers Karsenbarg
    Sep 3 '12 at 10:17






  • 1




    Wanted to downvote here but wording of question makes this a valid answer: I remembered that I used a tool...Now I cannot find this tool. Not sure if Windows has [it].
    – Ben
    Mar 15 at 18:54


















up vote
266
down vote













According to the StackOverflow answer at Is there an equivalent of 'which' on windows?, where.exe does this on Windows 7 and Windows Server 2003 and later:



Example



C:> where ping


Output:



C:WindowsSystem32PING.EXE





share|improve this answer



















  • 12




    This should be makred as the correct answer as it works without installing extra software
    – Cookie
    Oct 17 '14 at 12:28






  • 9




    An important part of this answer is that in powershell, where is a default alias for the Where-Object, so you instead need to use where.exe, or gcm/Get-Command
    – Dave Andersen
    Nov 13 '17 at 18:03






  • 1




    What about powershell. How can I achieve the same in powershell?
    – krv
    Sep 15 at 14:12


















up vote
14
down vote













EDIT: I should have added, if you can't use the WHERE command from the command prompt, check your PATH variable. (Just use the "path" command.) Make sure C:WindowsSystem32 is in your path. That's where "where.exe" is located.



WHERE is the command you're looking for! WHERE is like a cross between the UNIX shell built-in "which" and the "locate" command, in that it works for both command executables and regular files.



It's also somewhat more complex than either of those two, although, in general a simple



WHERE <file>


will work.



It's different from the "locate" command in that it's not looking through the entire filesystem. Instead, the default behavior is to look for files in two locations:




  • The current directory.

  • All of the directories in the PATH variable.


So, any command that you can run directly from a command prompt without specifying the directory, will be found by the WHERE command. (Because any command like that is already in the PATH variable list.)



If you want to search only in the command path variable, you can use:



WHERE "$path:<search text>"


If, on the other hand, you want to find all copies of a file in a directory tree, you can use:



WHERE /R <Top Level Directory> <search text>


Finally, WHERE will find commands and any files with an extension from the PATHEXT variable without including the extension. All other files have to be specified either exactly or with wildcards.



Take for example the files "dxdiag.exe" and "dxdiagn.dll". Note the following command and its output:



WHERE /R C:Windows dxdiag

C:WindowsSystem32dxdiag.exe
C:WindowsSysWOW64dxdiag.exe
C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiag.exe
C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiag.exe


It succeeds in returning all versions of "dxdiag.exe" because ".exe" is one of the extensions in the PATHEXT variable. (Note: "WHERE dxdiag" would have worked as well, because C:WindowsSystem32 is in the PATH variable.)



WHERE /R C:Windows dxdiagn


on the other hand, fails to return any result, because ".dll" is not in PATHEXT.



In this case, look at the result that adding a wildcard gives us:



WHERE /R C:Windows dxdiagn*

C:WindowsSystem32dxdiagn.dll
C:WindowsSystem32en-USdxdiagn.dll.mui
C:WindowsSysWOW64dxdiagn.dll
C:WindowsSysWOW64en-USdxdiagn.dll.mui
C:WindowsWinSxSamd64_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_daccd04369b09c70dxdiagn.dll.mui
C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiagn.dll
C:WindowsWinSxSx86_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_7eae34bfb1532b3adxdiagn.dll.mui
C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiagn.dll


It successfully returns all versions of dxdiagn.dll.



For more information, use "WHERE /?". Hope this helps!






share|improve this answer



















  • 1




    where where C:WindowsSystem32where.exe :)
    – vp_arth
    Dec 6 '16 at 15:13


















up vote
8
down vote













use dir:



cd 
dir /s /b mytool.exe


the cd part changes you to the root of the drive, to ensure searching starts at the top of the hierarchy.






share|improve this answer





















  • It seems like doing a command line Windows Search.
    – Ganesh R.
    Sep 30 '09 at 17:18






  • 4




    That does a recursive search of the drive and would take forever.
    – djhowell
    Sep 30 '09 at 17:19






  • 4




    The only way to find executables that AREN'T in the PATH environment variable is to do this. He never specified his path, he said any executable.
    – John T
    Sep 30 '09 at 17:31










  • it does find the executable but takes a while.
    – Michael Z
    Sep 2 '12 at 22:43










  • this of course only works if you know the name of the executable or at least a portion of the name
    – Oliver Williams
    Nov 17 '16 at 9:04


















up vote
4
down vote













Note that some things might be a little different for PowerShell:



PS C:UsersRob.wb-devel> where ping

PS C:UsersRob.wb-devel> where git

PS C:UsersRob.wb-devel> whereis.bat git
C:Program Files (x86)Gitcmdgit.exe

PS C:UsersRob.wb-devel> where.exe git
C:Program Files (x86)Gitcmdgit.exe





share|improve this answer




























    up vote
    3
    down vote













    Frustrating that it's not built-in as a simple command.



    However, there are several solutions, one of which is a batch file.



    Create a batch file (which.bat) as follows:



    @setlocal
    @set P2=.;%PATH%
    @for %%e in (%PATHEXT%) do @for %%i in (%~n1%%e) do @if NOT "%%~$P2:i"=="" echo %%~$P2:i


    This looks in the local directory, will take a filename parameter with or without an extension, and return the first match from the current directory or in the PATH.



    Then run it like which cmd.exe to find the cmd.exe that will execute if you type in cmd.






    share|improve this answer






























      up vote
      3
      down vote













      On windows you can use the free utility Everything search engine to search instantly for any file by full or partial name (if your hard disk is formatted in ntfs).






      share|improve this answer





















      • Night and day difference between this and windows search.
        – AnthonyVO
        Dec 15 '16 at 15:42


















      up vote
      1
      down vote













      If you just want which, the GnuWin32 project has a bunch of unix utils with individual installers.






      share|improve this answer




























        up vote
        1
        down vote













        In PowerShell



        (@($env:path.split(";")) + (pwd).Path)  | where { dir $_ -ErrorAction SilentlyContinue |? Name -eq foo.exe }


        You can easily convert this into a Cmdlet.



        Another way to accomplish this, as suggested in an edit:



        get-command notepad.exe | select Source





        share|improve this answer






























          up vote
          0
          down vote













          If you just need the path to launch it, it's often better to use the start command. For example, you can use "start chrome.exe" to start Chrom{e|ium}, regardless of where it is installed.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f49104%2fhow-do-i-find-the-location-of-an-executable-in-windows%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            10 Answers
            10






            active

            oldest

            votes








            10 Answers
            10






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            6
            down vote



            accepted










            I think you may be thinking of the which command in Linux.



            $ which bash
            /bin/bash


            I'm not aware of an equivalent tool in Windows.



            EDIT: I just remembered that there's a package called Unix Utils for Windows that would provide this functionality for you.






            share|improve this answer





















            • github.com/bmatzelle/gow/wiki is a descendant of Unix Utils that is more convenient to use, called Gnu on Windows. It has more utilities and an installer.
              – Simon D
              Jul 25 '12 at 6:38






            • 27




              Dammit I can't downvote. The OP was right and there is a "where.exe". See the answer below here: superuser.com/a/440904/59929
              – Piers Karsenbarg
              Sep 3 '12 at 10:17






            • 1




              Wanted to downvote here but wording of question makes this a valid answer: I remembered that I used a tool...Now I cannot find this tool. Not sure if Windows has [it].
              – Ben
              Mar 15 at 18:54















            up vote
            6
            down vote



            accepted










            I think you may be thinking of the which command in Linux.



            $ which bash
            /bin/bash


            I'm not aware of an equivalent tool in Windows.



            EDIT: I just remembered that there's a package called Unix Utils for Windows that would provide this functionality for you.






            share|improve this answer





















            • github.com/bmatzelle/gow/wiki is a descendant of Unix Utils that is more convenient to use, called Gnu on Windows. It has more utilities and an installer.
              – Simon D
              Jul 25 '12 at 6:38






            • 27




              Dammit I can't downvote. The OP was right and there is a "where.exe". See the answer below here: superuser.com/a/440904/59929
              – Piers Karsenbarg
              Sep 3 '12 at 10:17






            • 1




              Wanted to downvote here but wording of question makes this a valid answer: I remembered that I used a tool...Now I cannot find this tool. Not sure if Windows has [it].
              – Ben
              Mar 15 at 18:54













            up vote
            6
            down vote



            accepted







            up vote
            6
            down vote



            accepted






            I think you may be thinking of the which command in Linux.



            $ which bash
            /bin/bash


            I'm not aware of an equivalent tool in Windows.



            EDIT: I just remembered that there's a package called Unix Utils for Windows that would provide this functionality for you.






            share|improve this answer












            I think you may be thinking of the which command in Linux.



            $ which bash
            /bin/bash


            I'm not aware of an equivalent tool in Windows.



            EDIT: I just remembered that there's a package called Unix Utils for Windows that would provide this functionality for you.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 30 '09 at 17:11









            djhowell

            3,53511519




            3,53511519












            • github.com/bmatzelle/gow/wiki is a descendant of Unix Utils that is more convenient to use, called Gnu on Windows. It has more utilities and an installer.
              – Simon D
              Jul 25 '12 at 6:38






            • 27




              Dammit I can't downvote. The OP was right and there is a "where.exe". See the answer below here: superuser.com/a/440904/59929
              – Piers Karsenbarg
              Sep 3 '12 at 10:17






            • 1




              Wanted to downvote here but wording of question makes this a valid answer: I remembered that I used a tool...Now I cannot find this tool. Not sure if Windows has [it].
              – Ben
              Mar 15 at 18:54


















            • github.com/bmatzelle/gow/wiki is a descendant of Unix Utils that is more convenient to use, called Gnu on Windows. It has more utilities and an installer.
              – Simon D
              Jul 25 '12 at 6:38






            • 27




              Dammit I can't downvote. The OP was right and there is a "where.exe". See the answer below here: superuser.com/a/440904/59929
              – Piers Karsenbarg
              Sep 3 '12 at 10:17






            • 1




              Wanted to downvote here but wording of question makes this a valid answer: I remembered that I used a tool...Now I cannot find this tool. Not sure if Windows has [it].
              – Ben
              Mar 15 at 18:54
















            github.com/bmatzelle/gow/wiki is a descendant of Unix Utils that is more convenient to use, called Gnu on Windows. It has more utilities and an installer.
            – Simon D
            Jul 25 '12 at 6:38




            github.com/bmatzelle/gow/wiki is a descendant of Unix Utils that is more convenient to use, called Gnu on Windows. It has more utilities and an installer.
            – Simon D
            Jul 25 '12 at 6:38




            27




            27




            Dammit I can't downvote. The OP was right and there is a "where.exe". See the answer below here: superuser.com/a/440904/59929
            – Piers Karsenbarg
            Sep 3 '12 at 10:17




            Dammit I can't downvote. The OP was right and there is a "where.exe". See the answer below here: superuser.com/a/440904/59929
            – Piers Karsenbarg
            Sep 3 '12 at 10:17




            1




            1




            Wanted to downvote here but wording of question makes this a valid answer: I remembered that I used a tool...Now I cannot find this tool. Not sure if Windows has [it].
            – Ben
            Mar 15 at 18:54




            Wanted to downvote here but wording of question makes this a valid answer: I remembered that I used a tool...Now I cannot find this tool. Not sure if Windows has [it].
            – Ben
            Mar 15 at 18:54












            up vote
            266
            down vote













            According to the StackOverflow answer at Is there an equivalent of 'which' on windows?, where.exe does this on Windows 7 and Windows Server 2003 and later:



            Example



            C:> where ping


            Output:



            C:WindowsSystem32PING.EXE





            share|improve this answer



















            • 12




              This should be makred as the correct answer as it works without installing extra software
              – Cookie
              Oct 17 '14 at 12:28






            • 9




              An important part of this answer is that in powershell, where is a default alias for the Where-Object, so you instead need to use where.exe, or gcm/Get-Command
              – Dave Andersen
              Nov 13 '17 at 18:03






            • 1




              What about powershell. How can I achieve the same in powershell?
              – krv
              Sep 15 at 14:12















            up vote
            266
            down vote













            According to the StackOverflow answer at Is there an equivalent of 'which' on windows?, where.exe does this on Windows 7 and Windows Server 2003 and later:



            Example



            C:> where ping


            Output:



            C:WindowsSystem32PING.EXE





            share|improve this answer



















            • 12




              This should be makred as the correct answer as it works without installing extra software
              – Cookie
              Oct 17 '14 at 12:28






            • 9




              An important part of this answer is that in powershell, where is a default alias for the Where-Object, so you instead need to use where.exe, or gcm/Get-Command
              – Dave Andersen
              Nov 13 '17 at 18:03






            • 1




              What about powershell. How can I achieve the same in powershell?
              – krv
              Sep 15 at 14:12













            up vote
            266
            down vote










            up vote
            266
            down vote









            According to the StackOverflow answer at Is there an equivalent of 'which' on windows?, where.exe does this on Windows 7 and Windows Server 2003 and later:



            Example



            C:> where ping


            Output:



            C:WindowsSystem32PING.EXE





            share|improve this answer














            According to the StackOverflow answer at Is there an equivalent of 'which' on windows?, where.exe does this on Windows 7 and Windows Server 2003 and later:



            Example



            C:> where ping


            Output:



            C:WindowsSystem32PING.EXE






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 23 '17 at 12:41









            Community

            1




            1










            answered Jun 24 '12 at 11:41









            Simon D

            2,76811114




            2,76811114








            • 12




              This should be makred as the correct answer as it works without installing extra software
              – Cookie
              Oct 17 '14 at 12:28






            • 9




              An important part of this answer is that in powershell, where is a default alias for the Where-Object, so you instead need to use where.exe, or gcm/Get-Command
              – Dave Andersen
              Nov 13 '17 at 18:03






            • 1




              What about powershell. How can I achieve the same in powershell?
              – krv
              Sep 15 at 14:12














            • 12




              This should be makred as the correct answer as it works without installing extra software
              – Cookie
              Oct 17 '14 at 12:28






            • 9




              An important part of this answer is that in powershell, where is a default alias for the Where-Object, so you instead need to use where.exe, or gcm/Get-Command
              – Dave Andersen
              Nov 13 '17 at 18:03






            • 1




              What about powershell. How can I achieve the same in powershell?
              – krv
              Sep 15 at 14:12








            12




            12




            This should be makred as the correct answer as it works without installing extra software
            – Cookie
            Oct 17 '14 at 12:28




            This should be makred as the correct answer as it works without installing extra software
            – Cookie
            Oct 17 '14 at 12:28




            9




            9




            An important part of this answer is that in powershell, where is a default alias for the Where-Object, so you instead need to use where.exe, or gcm/Get-Command
            – Dave Andersen
            Nov 13 '17 at 18:03




            An important part of this answer is that in powershell, where is a default alias for the Where-Object, so you instead need to use where.exe, or gcm/Get-Command
            – Dave Andersen
            Nov 13 '17 at 18:03




            1




            1




            What about powershell. How can I achieve the same in powershell?
            – krv
            Sep 15 at 14:12




            What about powershell. How can I achieve the same in powershell?
            – krv
            Sep 15 at 14:12










            up vote
            14
            down vote













            EDIT: I should have added, if you can't use the WHERE command from the command prompt, check your PATH variable. (Just use the "path" command.) Make sure C:WindowsSystem32 is in your path. That's where "where.exe" is located.



            WHERE is the command you're looking for! WHERE is like a cross between the UNIX shell built-in "which" and the "locate" command, in that it works for both command executables and regular files.



            It's also somewhat more complex than either of those two, although, in general a simple



            WHERE <file>


            will work.



            It's different from the "locate" command in that it's not looking through the entire filesystem. Instead, the default behavior is to look for files in two locations:




            • The current directory.

            • All of the directories in the PATH variable.


            So, any command that you can run directly from a command prompt without specifying the directory, will be found by the WHERE command. (Because any command like that is already in the PATH variable list.)



            If you want to search only in the command path variable, you can use:



            WHERE "$path:<search text>"


            If, on the other hand, you want to find all copies of a file in a directory tree, you can use:



            WHERE /R <Top Level Directory> <search text>


            Finally, WHERE will find commands and any files with an extension from the PATHEXT variable without including the extension. All other files have to be specified either exactly or with wildcards.



            Take for example the files "dxdiag.exe" and "dxdiagn.dll". Note the following command and its output:



            WHERE /R C:Windows dxdiag

            C:WindowsSystem32dxdiag.exe
            C:WindowsSysWOW64dxdiag.exe
            C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiag.exe
            C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiag.exe


            It succeeds in returning all versions of "dxdiag.exe" because ".exe" is one of the extensions in the PATHEXT variable. (Note: "WHERE dxdiag" would have worked as well, because C:WindowsSystem32 is in the PATH variable.)



            WHERE /R C:Windows dxdiagn


            on the other hand, fails to return any result, because ".dll" is not in PATHEXT.



            In this case, look at the result that adding a wildcard gives us:



            WHERE /R C:Windows dxdiagn*

            C:WindowsSystem32dxdiagn.dll
            C:WindowsSystem32en-USdxdiagn.dll.mui
            C:WindowsSysWOW64dxdiagn.dll
            C:WindowsSysWOW64en-USdxdiagn.dll.mui
            C:WindowsWinSxSamd64_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_daccd04369b09c70dxdiagn.dll.mui
            C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiagn.dll
            C:WindowsWinSxSx86_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_7eae34bfb1532b3adxdiagn.dll.mui
            C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiagn.dll


            It successfully returns all versions of dxdiagn.dll.



            For more information, use "WHERE /?". Hope this helps!






            share|improve this answer



















            • 1




              where where C:WindowsSystem32where.exe :)
              – vp_arth
              Dec 6 '16 at 15:13















            up vote
            14
            down vote













            EDIT: I should have added, if you can't use the WHERE command from the command prompt, check your PATH variable. (Just use the "path" command.) Make sure C:WindowsSystem32 is in your path. That's where "where.exe" is located.



            WHERE is the command you're looking for! WHERE is like a cross between the UNIX shell built-in "which" and the "locate" command, in that it works for both command executables and regular files.



            It's also somewhat more complex than either of those two, although, in general a simple



            WHERE <file>


            will work.



            It's different from the "locate" command in that it's not looking through the entire filesystem. Instead, the default behavior is to look for files in two locations:




            • The current directory.

            • All of the directories in the PATH variable.


            So, any command that you can run directly from a command prompt without specifying the directory, will be found by the WHERE command. (Because any command like that is already in the PATH variable list.)



            If you want to search only in the command path variable, you can use:



            WHERE "$path:<search text>"


            If, on the other hand, you want to find all copies of a file in a directory tree, you can use:



            WHERE /R <Top Level Directory> <search text>


            Finally, WHERE will find commands and any files with an extension from the PATHEXT variable without including the extension. All other files have to be specified either exactly or with wildcards.



            Take for example the files "dxdiag.exe" and "dxdiagn.dll". Note the following command and its output:



            WHERE /R C:Windows dxdiag

            C:WindowsSystem32dxdiag.exe
            C:WindowsSysWOW64dxdiag.exe
            C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiag.exe
            C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiag.exe


            It succeeds in returning all versions of "dxdiag.exe" because ".exe" is one of the extensions in the PATHEXT variable. (Note: "WHERE dxdiag" would have worked as well, because C:WindowsSystem32 is in the PATH variable.)



            WHERE /R C:Windows dxdiagn


            on the other hand, fails to return any result, because ".dll" is not in PATHEXT.



            In this case, look at the result that adding a wildcard gives us:



            WHERE /R C:Windows dxdiagn*

            C:WindowsSystem32dxdiagn.dll
            C:WindowsSystem32en-USdxdiagn.dll.mui
            C:WindowsSysWOW64dxdiagn.dll
            C:WindowsSysWOW64en-USdxdiagn.dll.mui
            C:WindowsWinSxSamd64_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_daccd04369b09c70dxdiagn.dll.mui
            C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiagn.dll
            C:WindowsWinSxSx86_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_7eae34bfb1532b3adxdiagn.dll.mui
            C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiagn.dll


            It successfully returns all versions of dxdiagn.dll.



            For more information, use "WHERE /?". Hope this helps!






            share|improve this answer



















            • 1




              where where C:WindowsSystem32where.exe :)
              – vp_arth
              Dec 6 '16 at 15:13













            up vote
            14
            down vote










            up vote
            14
            down vote









            EDIT: I should have added, if you can't use the WHERE command from the command prompt, check your PATH variable. (Just use the "path" command.) Make sure C:WindowsSystem32 is in your path. That's where "where.exe" is located.



            WHERE is the command you're looking for! WHERE is like a cross between the UNIX shell built-in "which" and the "locate" command, in that it works for both command executables and regular files.



            It's also somewhat more complex than either of those two, although, in general a simple



            WHERE <file>


            will work.



            It's different from the "locate" command in that it's not looking through the entire filesystem. Instead, the default behavior is to look for files in two locations:




            • The current directory.

            • All of the directories in the PATH variable.


            So, any command that you can run directly from a command prompt without specifying the directory, will be found by the WHERE command. (Because any command like that is already in the PATH variable list.)



            If you want to search only in the command path variable, you can use:



            WHERE "$path:<search text>"


            If, on the other hand, you want to find all copies of a file in a directory tree, you can use:



            WHERE /R <Top Level Directory> <search text>


            Finally, WHERE will find commands and any files with an extension from the PATHEXT variable without including the extension. All other files have to be specified either exactly or with wildcards.



            Take for example the files "dxdiag.exe" and "dxdiagn.dll". Note the following command and its output:



            WHERE /R C:Windows dxdiag

            C:WindowsSystem32dxdiag.exe
            C:WindowsSysWOW64dxdiag.exe
            C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiag.exe
            C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiag.exe


            It succeeds in returning all versions of "dxdiag.exe" because ".exe" is one of the extensions in the PATHEXT variable. (Note: "WHERE dxdiag" would have worked as well, because C:WindowsSystem32 is in the PATH variable.)



            WHERE /R C:Windows dxdiagn


            on the other hand, fails to return any result, because ".dll" is not in PATHEXT.



            In this case, look at the result that adding a wildcard gives us:



            WHERE /R C:Windows dxdiagn*

            C:WindowsSystem32dxdiagn.dll
            C:WindowsSystem32en-USdxdiagn.dll.mui
            C:WindowsSysWOW64dxdiagn.dll
            C:WindowsSysWOW64en-USdxdiagn.dll.mui
            C:WindowsWinSxSamd64_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_daccd04369b09c70dxdiagn.dll.mui
            C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiagn.dll
            C:WindowsWinSxSx86_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_7eae34bfb1532b3adxdiagn.dll.mui
            C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiagn.dll


            It successfully returns all versions of dxdiagn.dll.



            For more information, use "WHERE /?". Hope this helps!






            share|improve this answer














            EDIT: I should have added, if you can't use the WHERE command from the command prompt, check your PATH variable. (Just use the "path" command.) Make sure C:WindowsSystem32 is in your path. That's where "where.exe" is located.



            WHERE is the command you're looking for! WHERE is like a cross between the UNIX shell built-in "which" and the "locate" command, in that it works for both command executables and regular files.



            It's also somewhat more complex than either of those two, although, in general a simple



            WHERE <file>


            will work.



            It's different from the "locate" command in that it's not looking through the entire filesystem. Instead, the default behavior is to look for files in two locations:




            • The current directory.

            • All of the directories in the PATH variable.


            So, any command that you can run directly from a command prompt without specifying the directory, will be found by the WHERE command. (Because any command like that is already in the PATH variable list.)



            If you want to search only in the command path variable, you can use:



            WHERE "$path:<search text>"


            If, on the other hand, you want to find all copies of a file in a directory tree, you can use:



            WHERE /R <Top Level Directory> <search text>


            Finally, WHERE will find commands and any files with an extension from the PATHEXT variable without including the extension. All other files have to be specified either exactly or with wildcards.



            Take for example the files "dxdiag.exe" and "dxdiagn.dll". Note the following command and its output:



            WHERE /R C:Windows dxdiag

            C:WindowsSystem32dxdiag.exe
            C:WindowsSysWOW64dxdiag.exe
            C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiag.exe
            C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiag.exe


            It succeeds in returning all versions of "dxdiag.exe" because ".exe" is one of the extensions in the PATHEXT variable. (Note: "WHERE dxdiag" would have worked as well, because C:WindowsSystem32 is in the PATH variable.)



            WHERE /R C:Windows dxdiagn


            on the other hand, fails to return any result, because ".dll" is not in PATHEXT.



            In this case, look at the result that adding a wildcard gives us:



            WHERE /R C:Windows dxdiagn*

            C:WindowsSystem32dxdiagn.dll
            C:WindowsSystem32en-USdxdiagn.dll.mui
            C:WindowsSysWOW64dxdiagn.dll
            C:WindowsSysWOW64en-USdxdiagn.dll.mui
            C:WindowsWinSxSamd64_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_daccd04369b09c70dxdiagn.dll.mui
            C:WindowsWinSxSamd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7dxdiagn.dll
            C:WindowsWinSxSx86_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_7eae34bfb1532b3adxdiagn.dll.mui
            C:WindowsWinSxSx86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91dxdiagn.dll


            It successfully returns all versions of dxdiagn.dll.



            For more information, use "WHERE /?". Hope this helps!







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 14 '16 at 22:20

























            answered Sep 27 '12 at 1:23









            geo

            45748




            45748








            • 1




              where where C:WindowsSystem32where.exe :)
              – vp_arth
              Dec 6 '16 at 15:13














            • 1




              where where C:WindowsSystem32where.exe :)
              – vp_arth
              Dec 6 '16 at 15:13








            1




            1




            where where C:WindowsSystem32where.exe :)
            – vp_arth
            Dec 6 '16 at 15:13




            where where C:WindowsSystem32where.exe :)
            – vp_arth
            Dec 6 '16 at 15:13










            up vote
            8
            down vote













            use dir:



            cd 
            dir /s /b mytool.exe


            the cd part changes you to the root of the drive, to ensure searching starts at the top of the hierarchy.






            share|improve this answer





















            • It seems like doing a command line Windows Search.
              – Ganesh R.
              Sep 30 '09 at 17:18






            • 4




              That does a recursive search of the drive and would take forever.
              – djhowell
              Sep 30 '09 at 17:19






            • 4




              The only way to find executables that AREN'T in the PATH environment variable is to do this. He never specified his path, he said any executable.
              – John T
              Sep 30 '09 at 17:31










            • it does find the executable but takes a while.
              – Michael Z
              Sep 2 '12 at 22:43










            • this of course only works if you know the name of the executable or at least a portion of the name
              – Oliver Williams
              Nov 17 '16 at 9:04















            up vote
            8
            down vote













            use dir:



            cd 
            dir /s /b mytool.exe


            the cd part changes you to the root of the drive, to ensure searching starts at the top of the hierarchy.






            share|improve this answer





















            • It seems like doing a command line Windows Search.
              – Ganesh R.
              Sep 30 '09 at 17:18






            • 4




              That does a recursive search of the drive and would take forever.
              – djhowell
              Sep 30 '09 at 17:19






            • 4




              The only way to find executables that AREN'T in the PATH environment variable is to do this. He never specified his path, he said any executable.
              – John T
              Sep 30 '09 at 17:31










            • it does find the executable but takes a while.
              – Michael Z
              Sep 2 '12 at 22:43










            • this of course only works if you know the name of the executable or at least a portion of the name
              – Oliver Williams
              Nov 17 '16 at 9:04













            up vote
            8
            down vote










            up vote
            8
            down vote









            use dir:



            cd 
            dir /s /b mytool.exe


            the cd part changes you to the root of the drive, to ensure searching starts at the top of the hierarchy.






            share|improve this answer












            use dir:



            cd 
            dir /s /b mytool.exe


            the cd part changes you to the root of the drive, to ensure searching starts at the top of the hierarchy.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 30 '09 at 17:15









            John T

            141k20291328




            141k20291328












            • It seems like doing a command line Windows Search.
              – Ganesh R.
              Sep 30 '09 at 17:18






            • 4




              That does a recursive search of the drive and would take forever.
              – djhowell
              Sep 30 '09 at 17:19






            • 4




              The only way to find executables that AREN'T in the PATH environment variable is to do this. He never specified his path, he said any executable.
              – John T
              Sep 30 '09 at 17:31










            • it does find the executable but takes a while.
              – Michael Z
              Sep 2 '12 at 22:43










            • this of course only works if you know the name of the executable or at least a portion of the name
              – Oliver Williams
              Nov 17 '16 at 9:04


















            • It seems like doing a command line Windows Search.
              – Ganesh R.
              Sep 30 '09 at 17:18






            • 4




              That does a recursive search of the drive and would take forever.
              – djhowell
              Sep 30 '09 at 17:19






            • 4




              The only way to find executables that AREN'T in the PATH environment variable is to do this. He never specified his path, he said any executable.
              – John T
              Sep 30 '09 at 17:31










            • it does find the executable but takes a while.
              – Michael Z
              Sep 2 '12 at 22:43










            • this of course only works if you know the name of the executable or at least a portion of the name
              – Oliver Williams
              Nov 17 '16 at 9:04
















            It seems like doing a command line Windows Search.
            – Ganesh R.
            Sep 30 '09 at 17:18




            It seems like doing a command line Windows Search.
            – Ganesh R.
            Sep 30 '09 at 17:18




            4




            4




            That does a recursive search of the drive and would take forever.
            – djhowell
            Sep 30 '09 at 17:19




            That does a recursive search of the drive and would take forever.
            – djhowell
            Sep 30 '09 at 17:19




            4




            4




            The only way to find executables that AREN'T in the PATH environment variable is to do this. He never specified his path, he said any executable.
            – John T
            Sep 30 '09 at 17:31




            The only way to find executables that AREN'T in the PATH environment variable is to do this. He never specified his path, he said any executable.
            – John T
            Sep 30 '09 at 17:31












            it does find the executable but takes a while.
            – Michael Z
            Sep 2 '12 at 22:43




            it does find the executable but takes a while.
            – Michael Z
            Sep 2 '12 at 22:43












            this of course only works if you know the name of the executable or at least a portion of the name
            – Oliver Williams
            Nov 17 '16 at 9:04




            this of course only works if you know the name of the executable or at least a portion of the name
            – Oliver Williams
            Nov 17 '16 at 9:04










            up vote
            4
            down vote













            Note that some things might be a little different for PowerShell:



            PS C:UsersRob.wb-devel> where ping

            PS C:UsersRob.wb-devel> where git

            PS C:UsersRob.wb-devel> whereis.bat git
            C:Program Files (x86)Gitcmdgit.exe

            PS C:UsersRob.wb-devel> where.exe git
            C:Program Files (x86)Gitcmdgit.exe





            share|improve this answer

























              up vote
              4
              down vote













              Note that some things might be a little different for PowerShell:



              PS C:UsersRob.wb-devel> where ping

              PS C:UsersRob.wb-devel> where git

              PS C:UsersRob.wb-devel> whereis.bat git
              C:Program Files (x86)Gitcmdgit.exe

              PS C:UsersRob.wb-devel> where.exe git
              C:Program Files (x86)Gitcmdgit.exe





              share|improve this answer























                up vote
                4
                down vote










                up vote
                4
                down vote









                Note that some things might be a little different for PowerShell:



                PS C:UsersRob.wb-devel> where ping

                PS C:UsersRob.wb-devel> where git

                PS C:UsersRob.wb-devel> whereis.bat git
                C:Program Files (x86)Gitcmdgit.exe

                PS C:UsersRob.wb-devel> where.exe git
                C:Program Files (x86)Gitcmdgit.exe





                share|improve this answer












                Note that some things might be a little different for PowerShell:



                PS C:UsersRob.wb-devel> where ping

                PS C:UsersRob.wb-devel> where git

                PS C:UsersRob.wb-devel> whereis.bat git
                C:Program Files (x86)Gitcmdgit.exe

                PS C:UsersRob.wb-devel> where.exe git
                C:Program Files (x86)Gitcmdgit.exe






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 7 '14 at 12:52









                Rob Jens

                1412




                1412






















                    up vote
                    3
                    down vote













                    Frustrating that it's not built-in as a simple command.



                    However, there are several solutions, one of which is a batch file.



                    Create a batch file (which.bat) as follows:



                    @setlocal
                    @set P2=.;%PATH%
                    @for %%e in (%PATHEXT%) do @for %%i in (%~n1%%e) do @if NOT "%%~$P2:i"=="" echo %%~$P2:i


                    This looks in the local directory, will take a filename parameter with or without an extension, and return the first match from the current directory or in the PATH.



                    Then run it like which cmd.exe to find the cmd.exe that will execute if you type in cmd.






                    share|improve this answer



























                      up vote
                      3
                      down vote













                      Frustrating that it's not built-in as a simple command.



                      However, there are several solutions, one of which is a batch file.



                      Create a batch file (which.bat) as follows:



                      @setlocal
                      @set P2=.;%PATH%
                      @for %%e in (%PATHEXT%) do @for %%i in (%~n1%%e) do @if NOT "%%~$P2:i"=="" echo %%~$P2:i


                      This looks in the local directory, will take a filename parameter with or without an extension, and return the first match from the current directory or in the PATH.



                      Then run it like which cmd.exe to find the cmd.exe that will execute if you type in cmd.






                      share|improve this answer

























                        up vote
                        3
                        down vote










                        up vote
                        3
                        down vote









                        Frustrating that it's not built-in as a simple command.



                        However, there are several solutions, one of which is a batch file.



                        Create a batch file (which.bat) as follows:



                        @setlocal
                        @set P2=.;%PATH%
                        @for %%e in (%PATHEXT%) do @for %%i in (%~n1%%e) do @if NOT "%%~$P2:i"=="" echo %%~$P2:i


                        This looks in the local directory, will take a filename parameter with or without an extension, and return the first match from the current directory or in the PATH.



                        Then run it like which cmd.exe to find the cmd.exe that will execute if you type in cmd.






                        share|improve this answer














                        Frustrating that it's not built-in as a simple command.



                        However, there are several solutions, one of which is a batch file.



                        Create a batch file (which.bat) as follows:



                        @setlocal
                        @set P2=.;%PATH%
                        @for %%e in (%PATHEXT%) do @for %%i in (%~n1%%e) do @if NOT "%%~$P2:i"=="" echo %%~$P2:i


                        This looks in the local directory, will take a filename parameter with or without an extension, and return the first match from the current directory or in the PATH.



                        Then run it like which cmd.exe to find the cmd.exe that will execute if you type in cmd.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Sep 30 '09 at 18:53

























                        answered Sep 30 '09 at 18:23









                        b w

                        2,09642230




                        2,09642230






















                            up vote
                            3
                            down vote













                            On windows you can use the free utility Everything search engine to search instantly for any file by full or partial name (if your hard disk is formatted in ntfs).






                            share|improve this answer





















                            • Night and day difference between this and windows search.
                              – AnthonyVO
                              Dec 15 '16 at 15:42















                            up vote
                            3
                            down vote













                            On windows you can use the free utility Everything search engine to search instantly for any file by full or partial name (if your hard disk is formatted in ntfs).






                            share|improve this answer





















                            • Night and day difference between this and windows search.
                              – AnthonyVO
                              Dec 15 '16 at 15:42













                            up vote
                            3
                            down vote










                            up vote
                            3
                            down vote









                            On windows you can use the free utility Everything search engine to search instantly for any file by full or partial name (if your hard disk is formatted in ntfs).






                            share|improve this answer












                            On windows you can use the free utility Everything search engine to search instantly for any file by full or partial name (if your hard disk is formatted in ntfs).







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Sep 30 '09 at 19:26









                            harrymc

                            250k10258554




                            250k10258554












                            • Night and day difference between this and windows search.
                              – AnthonyVO
                              Dec 15 '16 at 15:42


















                            • Night and day difference between this and windows search.
                              – AnthonyVO
                              Dec 15 '16 at 15:42
















                            Night and day difference between this and windows search.
                            – AnthonyVO
                            Dec 15 '16 at 15:42




                            Night and day difference between this and windows search.
                            – AnthonyVO
                            Dec 15 '16 at 15:42










                            up vote
                            1
                            down vote













                            If you just want which, the GnuWin32 project has a bunch of unix utils with individual installers.






                            share|improve this answer

























                              up vote
                              1
                              down vote













                              If you just want which, the GnuWin32 project has a bunch of unix utils with individual installers.






                              share|improve this answer























                                up vote
                                1
                                down vote










                                up vote
                                1
                                down vote









                                If you just want which, the GnuWin32 project has a bunch of unix utils with individual installers.






                                share|improve this answer












                                If you just want which, the GnuWin32 project has a bunch of unix utils with individual installers.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Sep 30 '09 at 17:19









                                Justin Love

                                70121833




                                70121833






















                                    up vote
                                    1
                                    down vote













                                    In PowerShell



                                    (@($env:path.split(";")) + (pwd).Path)  | where { dir $_ -ErrorAction SilentlyContinue |? Name -eq foo.exe }


                                    You can easily convert this into a Cmdlet.



                                    Another way to accomplish this, as suggested in an edit:



                                    get-command notepad.exe | select Source





                                    share|improve this answer



























                                      up vote
                                      1
                                      down vote













                                      In PowerShell



                                      (@($env:path.split(";")) + (pwd).Path)  | where { dir $_ -ErrorAction SilentlyContinue |? Name -eq foo.exe }


                                      You can easily convert this into a Cmdlet.



                                      Another way to accomplish this, as suggested in an edit:



                                      get-command notepad.exe | select Source





                                      share|improve this answer

























                                        up vote
                                        1
                                        down vote










                                        up vote
                                        1
                                        down vote









                                        In PowerShell



                                        (@($env:path.split(";")) + (pwd).Path)  | where { dir $_ -ErrorAction SilentlyContinue |? Name -eq foo.exe }


                                        You can easily convert this into a Cmdlet.



                                        Another way to accomplish this, as suggested in an edit:



                                        get-command notepad.exe | select Source





                                        share|improve this answer














                                        In PowerShell



                                        (@($env:path.split(";")) + (pwd).Path)  | where { dir $_ -ErrorAction SilentlyContinue |? Name -eq foo.exe }


                                        You can easily convert this into a Cmdlet.



                                        Another way to accomplish this, as suggested in an edit:



                                        get-command notepad.exe | select Source






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Nov 29 at 5:50

























                                        answered Sep 21 '15 at 17:59









                                        Anupam

                                        1113




                                        1113






















                                            up vote
                                            0
                                            down vote













                                            If you just need the path to launch it, it's often better to use the start command. For example, you can use "start chrome.exe" to start Chrom{e|ium}, regardless of where it is installed.






                                            share|improve this answer

























                                              up vote
                                              0
                                              down vote













                                              If you just need the path to launch it, it's often better to use the start command. For example, you can use "start chrome.exe" to start Chrom{e|ium}, regardless of where it is installed.






                                              share|improve this answer























                                                up vote
                                                0
                                                down vote










                                                up vote
                                                0
                                                down vote









                                                If you just need the path to launch it, it's often better to use the start command. For example, you can use "start chrome.exe" to start Chrom{e|ium}, regardless of where it is installed.






                                                share|improve this answer












                                                If you just need the path to launch it, it's often better to use the start command. For example, you can use "start chrome.exe" to start Chrom{e|ium}, regardless of where it is installed.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Apr 24 '13 at 16:35









                                                Anonymous Coward

                                                1




                                                1






























                                                    draft saved

                                                    draft discarded




















































                                                    Thanks for contributing an answer to Super User!


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.





                                                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                    Please pay close attention to the following guidance:


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f49104%2fhow-do-i-find-the-location-of-an-executable-in-windows%23new-answer', 'question_page');
                                                    }
                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown







                                                    Popular posts from this blog

                                                    How do I know what Microsoft account the skydrive app is syncing to?

                                                    When does type information flow backwards in C++?

                                                    Grease: Live!