powershell equivalent of linux “mkdir -p”?

You can ignore errors in PowerShell with the -ErrorAction SilentlyContinue parameter (you can shorten this to -ea 0). The full PowerShell command is

New-Item /foo/bar/baz -ItemType Directory -ea 0

You can shorten this to

md /foo/bar/baz -ea 0

(You can also type mkdir instead of md if you prefer.)

Note that PowerShell will output the DirectoryInfo object it creates when using New-Item -ItemType Directory (or the md or mkdir aliases). If you don’t want any output, you can pipe to Out-Null.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)