Coding Ref

How to make a directory in PowerShell

How to make a directory in PowerShell

To make a new directory in PowerShell, use the New-Item cmdlet with the -ItemType parameter set to Directory.

Here's an example:

New-Item -ItemType Directory -Path C:\mynewdirectory

This will create a new directory called mynewdirectory in the root of the C: drive. You can also specify a different location for the new directory by providing a different path for the -Path parameter.

Here's an example of creating a new directory in a specific location:

New-Item -ItemType Directory -Path C:\Users\John\Documents\mynewdirectory

This will create a new directory called mynewdirectory in the Documents directory of the user John.

Conclusion

To make a new directory in PowerShell, use the New-Item cmdlet with the -ItemType parameter set to Directory.

You'll also like

Related tutorials curated for you

    How to rename a computer in PowerShell

    How to write multiple-line comments in PowerShell

    How to print output in PowerShell

    Boolean literals in PowerShell

    How to create new items in PowerShell

    What is IEX in PowerShell?

    What is `ls` for PowerShell?

    What are classes in PowerShell?

    How to use String Contains in PowerShell

    How to use ErrorAction in PowerShell

    How to find the Windows version from the PowerShell command line

    How to join a domain in PowerShell