Which cmdlet would you use to create a new directory?

Prepare for the SANS Cyber Aces Test with flashcards and multiple choice questions. Each question includes detailed explanations. Get exam-ready today!

Multiple Choice

Which cmdlet would you use to create a new directory?

Explanation:
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.

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:


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.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy