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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With