Windows Symlink & working directory











up vote
4
down vote

favorite
2












I have a directory called apps/myapp/ with a file myapp.exe which uses myapp.dll and some other dlls.



Now lets say i want to symlink this to a directory, like one would do in linux.



bin/myapp.exe => verylongpath/myapp/myapp.exe. Ie using mklink bin/myapp.exe verylongpath/bin/myapp.exe



Now when i run the myapp, it's yelling against me that it can't find the dll. which means that the exe isn't run against its own working directory. Which makes me sad.



Is there somehow i can make it run in ints own working directory? Thanks!










share|improve this question
























  • Yes, Windows 7 supports NTFS symlinks in the form of the command mlink. Did you search? :) superuser.com/questions/234422/…
    – Moses
    Feb 22 '13 at 18:39















up vote
4
down vote

favorite
2












I have a directory called apps/myapp/ with a file myapp.exe which uses myapp.dll and some other dlls.



Now lets say i want to symlink this to a directory, like one would do in linux.



bin/myapp.exe => verylongpath/myapp/myapp.exe. Ie using mklink bin/myapp.exe verylongpath/bin/myapp.exe



Now when i run the myapp, it's yelling against me that it can't find the dll. which means that the exe isn't run against its own working directory. Which makes me sad.



Is there somehow i can make it run in ints own working directory? Thanks!










share|improve this question
























  • Yes, Windows 7 supports NTFS symlinks in the form of the command mlink. Did you search? :) superuser.com/questions/234422/…
    – Moses
    Feb 22 '13 at 18:39













up vote
4
down vote

favorite
2









up vote
4
down vote

favorite
2






2





I have a directory called apps/myapp/ with a file myapp.exe which uses myapp.dll and some other dlls.



Now lets say i want to symlink this to a directory, like one would do in linux.



bin/myapp.exe => verylongpath/myapp/myapp.exe. Ie using mklink bin/myapp.exe verylongpath/bin/myapp.exe



Now when i run the myapp, it's yelling against me that it can't find the dll. which means that the exe isn't run against its own working directory. Which makes me sad.



Is there somehow i can make it run in ints own working directory? Thanks!










share|improve this question















I have a directory called apps/myapp/ with a file myapp.exe which uses myapp.dll and some other dlls.



Now lets say i want to symlink this to a directory, like one would do in linux.



bin/myapp.exe => verylongpath/myapp/myapp.exe. Ie using mklink bin/myapp.exe verylongpath/bin/myapp.exe



Now when i run the myapp, it's yelling against me that it can't find the dll. which means that the exe isn't run against its own working directory. Which makes me sad.



Is there somehow i can make it run in ints own working directory? Thanks!







windows symbolic-link mklink






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 22 '13 at 15:24









user1301428

1,94072752




1,94072752










asked Feb 22 '13 at 14:24









Emile

212




212












  • Yes, Windows 7 supports NTFS symlinks in the form of the command mlink. Did you search? :) superuser.com/questions/234422/…
    – Moses
    Feb 22 '13 at 18:39


















  • Yes, Windows 7 supports NTFS symlinks in the form of the command mlink. Did you search? :) superuser.com/questions/234422/…
    – Moses
    Feb 22 '13 at 18:39
















Yes, Windows 7 supports NTFS symlinks in the form of the command mlink. Did you search? :) superuser.com/questions/234422/…
– Moses
Feb 22 '13 at 18:39




Yes, Windows 7 supports NTFS symlinks in the form of the command mlink. Did you search? :) superuser.com/questions/234422/…
– Moses
Feb 22 '13 at 18:39










2 Answers
2






active

oldest

votes

















up vote
2
down vote













What you will likely need to do is symbolically link the folder containing your application binaries rather than just the EXE file itself. The most compatible way to make a directory symbolic link in Windows is use their junction points.



Use this command:



mklink /J ..linktargetdir linkdirname


Paths to the target can be relative to the current location. You don't need to start from the drive letter.



Once this is done you should be able to CD into your linkdirname and run your application as normal.



FYI: You could use the /D option for a directory symbolic link, but in my experience I've found junction points to behave in a much nicer (and more compatible) way. Some applications aren't fooled by directory symbolic links, but happily work with junctions. For example, in Steam, I can re-route game folders using junctions, but not with directory symbolic links.






share|improve this answer




























    up vote
    0
    down vote













    You can create myapp.bat (instead of a link) and write below command into it:



    call "absolutepathofyourexcecutable" %*




    Example:



    @call "C:Program Files (x86)GnuWin32binopenssl.exe" %*


    Save above lines in openssl.bat everywhere you need a shortcut.






    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%2f555804%2fwindows-symlink-working-directory%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote













      What you will likely need to do is symbolically link the folder containing your application binaries rather than just the EXE file itself. The most compatible way to make a directory symbolic link in Windows is use their junction points.



      Use this command:



      mklink /J ..linktargetdir linkdirname


      Paths to the target can be relative to the current location. You don't need to start from the drive letter.



      Once this is done you should be able to CD into your linkdirname and run your application as normal.



      FYI: You could use the /D option for a directory symbolic link, but in my experience I've found junction points to behave in a much nicer (and more compatible) way. Some applications aren't fooled by directory symbolic links, but happily work with junctions. For example, in Steam, I can re-route game folders using junctions, but not with directory symbolic links.






      share|improve this answer

























        up vote
        2
        down vote













        What you will likely need to do is symbolically link the folder containing your application binaries rather than just the EXE file itself. The most compatible way to make a directory symbolic link in Windows is use their junction points.



        Use this command:



        mklink /J ..linktargetdir linkdirname


        Paths to the target can be relative to the current location. You don't need to start from the drive letter.



        Once this is done you should be able to CD into your linkdirname and run your application as normal.



        FYI: You could use the /D option for a directory symbolic link, but in my experience I've found junction points to behave in a much nicer (and more compatible) way. Some applications aren't fooled by directory symbolic links, but happily work with junctions. For example, in Steam, I can re-route game folders using junctions, but not with directory symbolic links.






        share|improve this answer























          up vote
          2
          down vote










          up vote
          2
          down vote









          What you will likely need to do is symbolically link the folder containing your application binaries rather than just the EXE file itself. The most compatible way to make a directory symbolic link in Windows is use their junction points.



          Use this command:



          mklink /J ..linktargetdir linkdirname


          Paths to the target can be relative to the current location. You don't need to start from the drive letter.



          Once this is done you should be able to CD into your linkdirname and run your application as normal.



          FYI: You could use the /D option for a directory symbolic link, but in my experience I've found junction points to behave in a much nicer (and more compatible) way. Some applications aren't fooled by directory symbolic links, but happily work with junctions. For example, in Steam, I can re-route game folders using junctions, but not with directory symbolic links.






          share|improve this answer












          What you will likely need to do is symbolically link the folder containing your application binaries rather than just the EXE file itself. The most compatible way to make a directory symbolic link in Windows is use their junction points.



          Use this command:



          mklink /J ..linktargetdir linkdirname


          Paths to the target can be relative to the current location. You don't need to start from the drive letter.



          Once this is done you should be able to CD into your linkdirname and run your application as normal.



          FYI: You could use the /D option for a directory symbolic link, but in my experience I've found junction points to behave in a much nicer (and more compatible) way. Some applications aren't fooled by directory symbolic links, but happily work with junctions. For example, in Steam, I can re-route game folders using junctions, but not with directory symbolic links.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 22 '13 at 21:23









          Adambean

          7051717




          7051717
























              up vote
              0
              down vote













              You can create myapp.bat (instead of a link) and write below command into it:



              call "absolutepathofyourexcecutable" %*




              Example:



              @call "C:Program Files (x86)GnuWin32binopenssl.exe" %*


              Save above lines in openssl.bat everywhere you need a shortcut.






              share|improve this answer



























                up vote
                0
                down vote













                You can create myapp.bat (instead of a link) and write below command into it:



                call "absolutepathofyourexcecutable" %*




                Example:



                @call "C:Program Files (x86)GnuWin32binopenssl.exe" %*


                Save above lines in openssl.bat everywhere you need a shortcut.






                share|improve this answer

























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  You can create myapp.bat (instead of a link) and write below command into it:



                  call "absolutepathofyourexcecutable" %*




                  Example:



                  @call "C:Program Files (x86)GnuWin32binopenssl.exe" %*


                  Save above lines in openssl.bat everywhere you need a shortcut.






                  share|improve this answer














                  You can create myapp.bat (instead of a link) and write below command into it:



                  call "absolutepathofyourexcecutable" %*




                  Example:



                  @call "C:Program Files (x86)GnuWin32binopenssl.exe" %*


                  Save above lines in openssl.bat everywhere you need a shortcut.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 25 at 7:32

























                  answered Nov 21 at 19:28









                  Mir-Ismaili

                  1135




                  1135






























                      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%2f555804%2fwindows-symlink-working-directory%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

                      QoS: MAC-Priority for clients behind a repeater

                      Ивакино (Тотемский район)

                      Can't locate Autom4te/ChannelDefs.pm in @INC (when it definitely is there)