Can mklink make portable links?

3

1

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?

RoboJ1M

Posted 2014-05-19T10:39:05.120

Reputation: 133

Answers

1

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.

LPChip

Posted 2014-05-19T10:39:05.120

Reputation: 42 190

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 – 2014-05-20T09:42:01.927

@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 – 2014-05-20T10:15:42.097