February 15, 2021

Hard Symbolic Links For Developers

Had a problem where the output of a (DEBUG) build went to one directory but the to run it needed to go somewhere else. This was easy to circumvent using hard links. Here is the command line for making a hard link (requires Administrator permissions)
mklink /J {SourceDirectory} {TargetDirectory}

The Source directory must NOT exist and the Target directory must. This is because the Source directory is created as a symbolic link to the hard directory
Here was my script:
mklink /J "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Plugins\ICMP" 
          "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Service\Plugins\ICMP"
mklink /J "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Plugins\RelayBoard" 
          "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Service\Plugins\RelayBoard"
mklink /J "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Plugins\SeveritySetter" 
          "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Service\Plugins\SeveritySetter"
mklink /J "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Plugins\SMTP" 
          "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Service\Plugins\SMTP"
mklink /J "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Plugins\WMI" 
          "C:\Src\repos\XxxRepo\bin\Debug\TheProduct.Service\Plugins\WMI"

No comments: