Windows Powershell 中的 mklink 相当于什么?

Ble*_*eek 6 windows powershell symlink

当我右移一个文件夹时,我已经能够“在此处打开命令窗口”。

注意:我对重新启用此功能的注册表黑客不感兴趣。

之后我可以使用 mklink 创建符号链接。

在微软最近的深刻智慧下,在最近几次 Windows 10 更新之后,“此处的命令窗口”已被替换为“此处的 powershell”。

因此,遵守微软受人尊敬的智慧,暗示我应该使用 powershell 而不是过时的 cmd

  • 在powershell中制作软链接相当于什么?
  • 以及 mklink 可以建立的任何其他类型的链接?

Man*_*aga 18

这在[1]中得到了回答:https ://stackoverflow.com/a/34905638/4744055

但使用New-ItemPowershell命令。不再需要 DOS CMD。

   New-Item -Path <to> -ItemType SymbolicLink -Value <from>
Run Code Online (Sandbox Code Playgroud)

其中<to>是放置新符号链接的位置,<from>是新符号链接的目标。例如

   New-Item -Path "$env:USERPROFILE\desktop\MyNewLinkToCmd.exe" `
            -ItemType SymbolicLink -Value "c:\windows\system32\cmd.exe"
Run Code Online (Sandbox Code Playgroud)

另请注意,您必须从以管理员身份运行的 Powershell 中运行此命令。


Lid*_*dia 12

您可以通过以下方式在 PowerShell 中创建软链接:

cmd /c mklink /J "<link>" "<target>"
Run Code Online (Sandbox Code Playgroud)

上面cmd在PowerShell中使用旧的。但是,上述方法不适用于符号链接 (/D)。