SANS Cyber Aces Practice Test

Session length

1 / 20

Which cmdlet would you use to create a new directory?

New-Directory

Make-Directory

New-Item

Using the cmdlet "New-Item" is the correct choice for creating a new directory in PowerShell. This cmdlet allows users to create a variety of items, including files, directories, and registry keys, depending on the parameters provided. When creating a new directory, you typically specify the type of item with the "-ItemType" parameter set to "directory."

For example, to create a new directory called "ExampleDir," you would use the following command:

```powershell

New-Item -Path "C:\Path\To\Your\Directory" -Name "ExampleDir" -ItemType Directory

```

This flexibility makes "New-Item" a powerful cmdlet, as it can adapt to different types of creations beyond just directories, whereas the other options listed are either not valid cmdlets in PowerShell or do not exist.

Create-Directory

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy