Complete the code to create a new folder named 'TestFolder' in the current directory.
New-Item -Path . -Name 'TestFolder' -ItemType [1]
The New-Item cmdlet creates a new item. To create a folder, use -ItemType Directory.
Complete the code to create a new empty file named 'notes.txt' in the 'Documents' folder.
New-Item -Path $HOME\Documents -Name 'notes.txt' -ItemType [1]
To create a new file, use -ItemType File. This creates an empty file named 'notes.txt'.
Fix the error in the code to create a new folder named 'Projects' in 'C:\Users\Public'.
New-Item -Path 'C:\Users\Public' -Name 'Projects' -ItemType [1]
The correct -ItemType to create a folder is Directory. 'Folder' is not valid.
Fill both blanks to create a new file named 'log.txt' in the 'C:\Temp' directory and force overwrite if it exists.
New-Item -Path [1] -Name [2] -ItemType File -Force
Use -Path 'C:\Temp' and -Name 'log.txt' to create the file in the right place with the right name.
Fill all three blanks to create a new directory named 'Backup' inside 'D:\Data' and confirm creation with a message.
$folder = New-Item -Path [1] -Name [2] -ItemType [3]; Write-Host "Created folder: $($folder.FullName)"
Use -Path 'D:\Data', -Name 'Backup', and -ItemType Directory to create the folder. The message confirms the full path.