使用 PowerShell 创建硬链接和软链接 [英] Creating hard and soft links using PowerShell

查看:67
本文介绍了使用 PowerShell 创建硬链接和软链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PowerShell 1.0 能否创建类似于 Unix 变体的硬链接和软链接?

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

如果这不是内置的,有人可以将我指向一个具有模仿此功能的 ps1 脚本的站点吗?

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

恕我直言,这是任何好的 shell 的必要功能.:)

This is a necessary function of any good shell, IMHO. :)

推荐答案

可以调用cmd提供的mklink,从PowerShell中建立符号链接:

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

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

如果目标是目录,则必须将 /d 传递给 mklink.

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

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

对于硬链接,我建议使用 Sysinternals Junction 之类的内容.

For hard links, I suggest something like Sysinternals Junction.

这篇关于使用 PowerShell 创建硬链接和软链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆