Friday, 6 May 2022

Create a Directory with PowerShell

 https://www.faqforge.com/powershell/create-directory-help-powershell/

 

Create a Directory with PowerShell

To create a directory with the help of PowerShell, open the PowerShell console with administrative privileges and use one of the following four ways.

Creating a Directory by using PowerShell

Method 1: Use the new-item command

new-item <path of directory suppose c:\dir1> -itemtype 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")

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive