Getting an error while creating multiple folders using `powershell` command-line

I am trying to create multiple folders using windows powershell by typing this into the command-line mkdir folder-one folder-one/sub-folder folder-two.

However, I get the following error:

C:\Tutorials\try> mkdir folder-one folder-one/sub-folder folder-two
mkdir : A positional parameter cannot be found that accepts argument 'folder-one/sub-folder'.
At line:1 char:1
+ mkdir folder-one folder-one/sub-folder folder-two
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [mkdir], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,mkdir

What is wrong with my command here? Can anyone help me to create multiple folders (nested folders)?


Solution 1:

You should separate paths with commas so they will be interpreted as a string array.

mkdir folder-one, folder-one/sub-folder, folder-two

Space is used to separate cmdlet parameters.