Is there any way to create portable links in NTFS using mklink? Or it there a better solution?

I want to be able to distribute an application in a zip file or folder copy where there is one "real" exe and one pointer to the exe using a different name, for example:

C:\Temp\link test\source>dir
 Volume in drive C is OS

 Directory of C:\Temp\link test\source

19/05/2014  11:35    <DIR>          .
19/05/2014  11:35    <DIR>          ..
19/05/2014  11:35    <SYMLINK>      OldService.exe [NewService.exe]
19/05/2014  11:32                 9 NewService.exe

That doesn't work though, if you copy it.

You just get two copies of the original file. The config file has to be linked as well (.exe.config) so that the config doesn't get out of sync.

Any way to make portable links?


Symbolic links is a feature of the NTFS filesystem structure. ZIP files don't have this capability in them as far as I know. So if you need to distribute this in a zip file it won't work.

You can however create a batchfile that you run after unzipping the content that will create the links, but you need to note that the batchfile has to be run as administrator.

  • Zip is not strictly necessary, just some method of transporting a-folder-of-stuff. Build, Release, Deploy, etc. As it's a windows service and we trigger it's installer classes with a batchfile which is part of the deployment, I'll try that. I may have to mark the other one as the answer, because it's a more general answer which more closely suits the question (got to test it first though) – RoboJ1M May 20 '14 at 9:42
  • @RoboJ1M sure. I can understand that. My answer was aimed at using all knowledge you provided, but I agree that the other answer works very well. – LPChip May 20 '14 at 10:15

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.