4

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!

2

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 ..\link\target\dir 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.

0

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

call "absolute\path\of\your\excecutable" %*

Example:

@call "C:\Program Files (x86)\GnuWin32\bin\openssl.exe" %*

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.