Powershell 参数错误“p"

编程入门 行业动态 更新时间:2024-10-27 01:20:06
本文介绍了Powershell 参数错误“p"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我试着输入这个命令

mkdir -p lol\hit\xx

但我收到一条错误消息

mkdir: Parameter cannot be processed because the parameter name 'p' is ambiguous.

我正在学习在线教程,根据该教程,应该没有任何错误.这背后的原因是什么?

I am following a tutorial online and according to that, there shouldn't be any error. What is the reason behind this?

推荐答案

mkdir,在 PowerShell 中运行时,作为 New-Item 的别名运行.这可以通过在 PowerShell 中运行 Get-Help mkdir 来查看.

mkdir, when run in PowerShell, runs as an alias to New-Item. This can be seen by running Get-Help mkdir within PowerShell.

在那种情况下 -p 是不明确的,因为它可以是 New-Item 的 -Path-PipelineVariable 参数之一.我相信你想要的是:

In that case -p is ambiguous because it could be either of the -Path or -PipelineVariable arguments for New-Item. I believe that what you want is:

mkdir -path lol\hit\xx

这将在您当前的位置创建 lol 文件夹,以及其中的 hit 文件夹,以及其中的 xx 文件夹.

That will create the lol folder at your current location, and the hit folder inside it, and the xx folder inside of that.

Unix 中 mkdir 的 -p 开关强制命令创建到达您指定路径所需的所有文件夹(因此,如果您拥有的只是lol",它将在其中创建hit"文件夹,然后创建'hit' 文件夹中的 'xx' 文件夹).默认情况下,PowerShell 的 New-Item 会执行此操作.

The -p switch for mkdir in Unix forces the command to create all folders needed to get to the path you designate (so if all you had was 'lol' it would creates the 'hit' folder within that, and then create the 'xx' folder within the 'hit' folder). PowerShell's New-Item does this by default.

这篇关于Powershell 参数错误“p"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 21:01:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1123411.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   参数   Powershell   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!