How to open windows explorer from current working directory of WSL shell?












2














When I type "bash" to the windows explorer address bar and hit Enter, it opens the shell in that directory. Often I find myself wanting to work on files with windows programs in the working directory I reached through shell. Is there an easy way to open explorer from the location reached through shell?










share|improve this question






















  • lets say I navigate in shell to /mnt/c/Users/adam/Dropbox/folder and I want to work in that directory, I would like to open explorer at that exact location
    – wesalius
    Jul 13 '18 at 21:24
















2














When I type "bash" to the windows explorer address bar and hit Enter, it opens the shell in that directory. Often I find myself wanting to work on files with windows programs in the working directory I reached through shell. Is there an easy way to open explorer from the location reached through shell?










share|improve this question






















  • lets say I navigate in shell to /mnt/c/Users/adam/Dropbox/folder and I want to work in that directory, I would like to open explorer at that exact location
    – wesalius
    Jul 13 '18 at 21:24














2












2








2


1





When I type "bash" to the windows explorer address bar and hit Enter, it opens the shell in that directory. Often I find myself wanting to work on files with windows programs in the working directory I reached through shell. Is there an easy way to open explorer from the location reached through shell?










share|improve this question













When I type "bash" to the windows explorer address bar and hit Enter, it opens the shell in that directory. Often I find myself wanting to work on files with windows programs in the working directory I reached through shell. Is there an easy way to open explorer from the location reached through shell?







windows-subsystem-for-linux






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 13 '18 at 17:58









wesalius

208




208












  • lets say I navigate in shell to /mnt/c/Users/adam/Dropbox/folder and I want to work in that directory, I would like to open explorer at that exact location
    – wesalius
    Jul 13 '18 at 21:24


















  • lets say I navigate in shell to /mnt/c/Users/adam/Dropbox/folder and I want to work in that directory, I would like to open explorer at that exact location
    – wesalius
    Jul 13 '18 at 21:24
















lets say I navigate in shell to /mnt/c/Users/adam/Dropbox/folder and I want to work in that directory, I would like to open explorer at that exact location
– wesalius
Jul 13 '18 at 21:24




lets say I navigate in shell to /mnt/c/Users/adam/Dropbox/folder and I want to work in that directory, I would like to open explorer at that exact location
– wesalius
Jul 13 '18 at 21:24










3 Answers
3






active

oldest

votes


















1















To open the current directory in Explorer - use the following (WSL sets the Windows path by itself):



explorer.exe .




You can set alias with .bashrc for a custom command:



echo 'alias explorer="explorer.exe ."' >> ~/.bashrc
source ~/.bashrc


Now just use:



explorer 


to open the current working directory in Windows Explorer.






share|improve this answer































    3














    Microsoft provides a binary wslpath for exactly this purpose.



    explorer.exe `wslpath -w "$PWD"`


    Cribbing from the github issue asking for usage info, there are 4 options - -a, -u, -w and -m.



    wslpath usage:
    -a force result to absolute path format
    -u translate from a Windows path to a WSL path (default)
    -w translate from a WSL path to a Windows path
    -m translate from a WSL path to a Windows path, with ‘/’ instead of ‘\’

    EX: wslpath ‘c:users’







    share|improve this answer































      0














      From a WSL shell prompt, run



      explorer.exe "Windows path"


      such as



      explorer.exe L:


      If L: maps to your desired directory (any unused drive letter may be used for this). You can map to network drives within Explorer, or to a local folder with SUBST.



      Problem is, your /home/USERNAME/ folder in WSL appears to Windows something like C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester . You could use SUBST to turn this into a drive letter a la
      SUBST L: C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester then use a relative path from L: for your destination.



      Let's say you have a WSL folder /home/YOURUSERNAME/acme/novelties . You could get close to there with explorer.exe L: but explorer.exe L:acme or explorer.exe acmenovelties will not bring you to where you wish to be, and instead will bring you to your Windows user Documents folder, instead.






      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',
        autoActivateHeartbeat: false,
        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%2f1338991%2fhow-to-open-windows-explorer-from-current-working-directory-of-wsl-shell%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1















        To open the current directory in Explorer - use the following (WSL sets the Windows path by itself):



        explorer.exe .




        You can set alias with .bashrc for a custom command:



        echo 'alias explorer="explorer.exe ."' >> ~/.bashrc
        source ~/.bashrc


        Now just use:



        explorer 


        to open the current working directory in Windows Explorer.






        share|improve this answer




























          1















          To open the current directory in Explorer - use the following (WSL sets the Windows path by itself):



          explorer.exe .




          You can set alias with .bashrc for a custom command:



          echo 'alias explorer="explorer.exe ."' >> ~/.bashrc
          source ~/.bashrc


          Now just use:



          explorer 


          to open the current working directory in Windows Explorer.






          share|improve this answer


























            1












            1








            1







            To open the current directory in Explorer - use the following (WSL sets the Windows path by itself):



            explorer.exe .




            You can set alias with .bashrc for a custom command:



            echo 'alias explorer="explorer.exe ."' >> ~/.bashrc
            source ~/.bashrc


            Now just use:



            explorer 


            to open the current working directory in Windows Explorer.






            share|improve this answer















            To open the current directory in Explorer - use the following (WSL sets the Windows path by itself):



            explorer.exe .




            You can set alias with .bashrc for a custom command:



            echo 'alias explorer="explorer.exe ."' >> ~/.bashrc
            source ~/.bashrc


            Now just use:



            explorer 


            to open the current working directory in Windows Explorer.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 18 '18 at 11:21









            Glorfindel

            1,35441220




            1,35441220










            answered Dec 18 '18 at 9:15









            Sole Sensei

            261




            261

























                3














                Microsoft provides a binary wslpath for exactly this purpose.



                explorer.exe `wslpath -w "$PWD"`


                Cribbing from the github issue asking for usage info, there are 4 options - -a, -u, -w and -m.



                wslpath usage:
                -a force result to absolute path format
                -u translate from a Windows path to a WSL path (default)
                -w translate from a WSL path to a Windows path
                -m translate from a WSL path to a Windows path, with ‘/’ instead of ‘\’

                EX: wslpath ‘c:users’







                share|improve this answer




























                  3














                  Microsoft provides a binary wslpath for exactly this purpose.



                  explorer.exe `wslpath -w "$PWD"`


                  Cribbing from the github issue asking for usage info, there are 4 options - -a, -u, -w and -m.



                  wslpath usage:
                  -a force result to absolute path format
                  -u translate from a Windows path to a WSL path (default)
                  -w translate from a WSL path to a Windows path
                  -m translate from a WSL path to a Windows path, with ‘/’ instead of ‘\’

                  EX: wslpath ‘c:users’







                  share|improve this answer


























                    3












                    3








                    3






                    Microsoft provides a binary wslpath for exactly this purpose.



                    explorer.exe `wslpath -w "$PWD"`


                    Cribbing from the github issue asking for usage info, there are 4 options - -a, -u, -w and -m.



                    wslpath usage:
                    -a force result to absolute path format
                    -u translate from a Windows path to a WSL path (default)
                    -w translate from a WSL path to a Windows path
                    -m translate from a WSL path to a Windows path, with ‘/’ instead of ‘\’

                    EX: wslpath ‘c:users’







                    share|improve this answer














                    Microsoft provides a binary wslpath for exactly this purpose.



                    explorer.exe `wslpath -w "$PWD"`


                    Cribbing from the github issue asking for usage info, there are 4 options - -a, -u, -w and -m.



                    wslpath usage:
                    -a force result to absolute path format
                    -u translate from a Windows path to a WSL path (default)
                    -w translate from a WSL path to a Windows path
                    -m translate from a WSL path to a Windows path, with ‘/’ instead of ‘\’

                    EX: wslpath ‘c:users’








                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jul 27 '18 at 5:48

























                    answered Jul 26 '18 at 23:24









                    laverya

                    539




                    539























                        0














                        From a WSL shell prompt, run



                        explorer.exe "Windows path"


                        such as



                        explorer.exe L:


                        If L: maps to your desired directory (any unused drive letter may be used for this). You can map to network drives within Explorer, or to a local folder with SUBST.



                        Problem is, your /home/USERNAME/ folder in WSL appears to Windows something like C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester . You could use SUBST to turn this into a drive letter a la
                        SUBST L: C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester then use a relative path from L: for your destination.



                        Let's say you have a WSL folder /home/YOURUSERNAME/acme/novelties . You could get close to there with explorer.exe L: but explorer.exe L:acme or explorer.exe acmenovelties will not bring you to where you wish to be, and instead will bring you to your Windows user Documents folder, instead.






                        share|improve this answer


























                          0














                          From a WSL shell prompt, run



                          explorer.exe "Windows path"


                          such as



                          explorer.exe L:


                          If L: maps to your desired directory (any unused drive letter may be used for this). You can map to network drives within Explorer, or to a local folder with SUBST.



                          Problem is, your /home/USERNAME/ folder in WSL appears to Windows something like C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester . You could use SUBST to turn this into a drive letter a la
                          SUBST L: C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester then use a relative path from L: for your destination.



                          Let's say you have a WSL folder /home/YOURUSERNAME/acme/novelties . You could get close to there with explorer.exe L: but explorer.exe L:acme or explorer.exe acmenovelties will not bring you to where you wish to be, and instead will bring you to your Windows user Documents folder, instead.






                          share|improve this answer
























                            0












                            0








                            0






                            From a WSL shell prompt, run



                            explorer.exe "Windows path"


                            such as



                            explorer.exe L:


                            If L: maps to your desired directory (any unused drive letter may be used for this). You can map to network drives within Explorer, or to a local folder with SUBST.



                            Problem is, your /home/USERNAME/ folder in WSL appears to Windows something like C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester . You could use SUBST to turn this into a drive letter a la
                            SUBST L: C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester then use a relative path from L: for your destination.



                            Let's say you have a WSL folder /home/YOURUSERNAME/acme/novelties . You could get close to there with explorer.exe L: but explorer.exe L:acme or explorer.exe acmenovelties will not bring you to where you wish to be, and instead will bring you to your Windows user Documents folder, instead.






                            share|improve this answer












                            From a WSL shell prompt, run



                            explorer.exe "Windows path"


                            such as



                            explorer.exe L:


                            If L: maps to your desired directory (any unused drive letter may be used for this). You can map to network drives within Explorer, or to a local folder with SUBST.



                            Problem is, your /home/USERNAME/ folder in WSL appears to Windows something like C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester . You could use SUBST to turn this into a drive letter a la
                            SUBST L: C:UsersYOURUSERNAMEAppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalStaterootfshometester then use a relative path from L: for your destination.



                            Let's say you have a WSL folder /home/YOURUSERNAME/acme/novelties . You could get close to there with explorer.exe L: but explorer.exe L:acme or explorer.exe acmenovelties will not bring you to where you wish to be, and instead will bring you to your Windows user Documents folder, instead.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jul 13 '18 at 18:42









                            K7AAY

                            3,66621438




                            3,66621438






























                                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%2f1338991%2fhow-to-open-windows-explorer-from-current-working-directory-of-wsl-shell%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

                                flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                                Mangá

                                 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕