X

Four Ways to Create a Directory with PowerShell

This tutorial shows you for different methods to create a directory with the help of PowerShell. First, open the PowerShell console with administrative privileges. Then use one of the following four ways to create directories.

Creating a Directory by using PowerShell

So how to create directory a now? Here are 5 create directory cmd variants that are easy to use on the command line:

Method 1: Use the new-item command

new-item <path of directory suppose c:\dir1> -itemtype directory

to create a new directory in the path or current working directory or parent directory.

Method 2: Use a file system object

$fso = new-object -ComObject scripting.filesystemobject

$fso.CreateFolder("path of directory suppose C:\test1")

Method 3: Use the md command

md <path of directory suppose c:\test5>

Method 4: Use the CreateDirectory method of system.io.directory object

[system.io.directory]::CreateDirectory("path of directory suppose c:\test5")

Have a look here if you like to create directory in Unix or create new folder in ubuntu using mkdir command.

FAQForge:
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings