-p and -type file

Can someone tell me what does “-p” mean and do?

for example: mkdir -p i/like/icecream

and what does “-type file” mean and do?

for example: New-Item iamcool.txt -type file

I am coding in windows powershell. I don´t understand this specific commands because i tried to do the same command lines without them and it worked out fine.

Thank you for your time.

I’m not very proficient with Powershell but I think -p means “this is the path argument”. That argument is a positional argument, I guess that’s why it works implicitly, too.

Have you tried help new-item or the powershell documentation?


@florian, thanks for the help, im going to try the help command, hopefully I understant it better!

@florian is right about -p. It specifices the path for the folder you want to create.

the -type argument is to tell New-Item that you want to create an item of a certain type.

for example if I use: New-Item -type file test. It will create a file named: test

Alternatively if I ran: New-Item -type dir test. It will create a folder named: test

mkdir is an Alias for New-item -type dir. It’s like a shorthand for it.