Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell parameter error 'p'

I tried typing this command

mkdir -p lol\hit\xx

But I get an error message

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?

like image 556
mahacoder Avatar asked Sep 30 '14 19:09

mahacoder


1 Answers

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

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

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

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.

like image 109
TheMadTechnician Avatar answered Nov 15 '22 00:11

TheMadTechnician