5

I'm using

mklink /h "C:\Shortcut.exe" "C:\Real.exe"

to create a hard symbolic file link.

However, I don't see how I could specify the "Start in:" property for the Target file or parameters.

Is there a way to do that?

tmighty
  • 10,734
  • 21
  • 104
  • 218
  • You're confusing a shell .LNK shortcut with a filesystem link (i.e. hard link, symbolic link, or junction). A hard link is an additional name for a file within a volume. NTFS supports up to 1023 hard links per file. A symbolic link or junction is a reparse point. When the kernel's I/O Manager encounters a reparse point, it restarts parsing the path in the Object Manager, which allows up to 64 reparse attempts (32 in older versions). A .LNK shortcut is a file type used by the Windows shell to link to items in the shell namespace, including files. It's much more than a filesystem link. – Eryk Sun Oct 30 '17 at 02:28
  • I'm dealing with a situation where a 3rd party application attemps to run a subprozess (an .exe). I would like to redirect this request so that the application thinks it started its subprocess while I redirect it to some other process. I would need a "hard link" for that (as I do create one in my example code, right?), right? – tmighty Nov 01 '17 at 10:20
  • In general that won't work because the target executable expects to find resources (e.g. DLLs) either in or relative to the application directory. If run from a hard or symbolic link, then the loader uses the location of the link itself as the application directory. – Eryk Sun Nov 01 '17 at 10:45
  • And if I rename the original resources as "_orig.exe" and name the hard link as "orig.exe" and link the "orig.exe" to "_orig.exe". Wouldn't that work? – tmighty Nov 01 '17 at 12:05
  • Is it in the same directory? A symbolic link or hard link that's right beside the original executable will generally work (e.g. a symlink from program.exe to program3.2.exe). But using a link to an application in another directory generally won't work. – Eryk Sun Nov 01 '17 at 15:58

1 Answers1

1

You can create Shortcut.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.

Mir-Ismaili
  • 13,974
  • 8
  • 82
  • 100