Creating hard and soft links using PowerShell

前端 未结 11 1726
攒了一身酷
攒了一身酷 2020-12-04 05:04

Can PowerShell 1.0 create hard and soft links analogous to the Unix variety?

If this isn\'t built in, can someone point me to a site that has a ps1 script that mimi

11条回答
  •  生来不讨喜
    2020-12-04 05:28

    You can call the mklink provided by cmd, from PowerShell to make symbolic links:

    cmd /c mklink c:\path\to\symlink c:\target\file
    

    You must pass /d to mklink if the target is a directory.

    cmd /c mklink /d c:\path\to\symlink c:\target\directory
    

    For hard links, I suggest something like Sysinternals Junction.

提交回复
热议问题