Bird
0
0

You want to create a folder named Projects inside C:\Work and inside it create a file README.md with the text Project Start. Which sequence of commands achieves this?

hard📝 Application Q15 of 15
PowerShell - File and Directory Operations
You want to create a folder named Projects inside C:\Work and inside it create a file README.md with the text Project Start. Which sequence of commands achieves this?
ANew-Item -Path 'C:\Work\Projects' -ItemType Directory; New-Item -Path 'C:\Work\Projects\README.md' -ItemType File -Value 'Project Start'
BNew-Item -Path 'C:\Work\Projects\README.md' -ItemType File -Value 'Project Start'; New-Item -Path 'C:\Work\Projects' -ItemType Directory
CNew-Item -Path 'C:\Work\Projects' -ItemType File; New-Item -Path 'C:\Work\Projects\README.md' -ItemType Directory -Value 'Project Start'
DNew-Item -Path 'C:\Work\Projects\README.md' -ItemType Directory; New-Item -Path 'C:\Work\Projects' -ItemType File -Value 'Project Start'
Step-by-Step Solution
Solution:
  1. Step 1: Create the folder first

    The folder 'Projects' inside 'C:\Work' must be created first using -ItemType Directory.
  2. Step 2: Create the file inside the new folder with content

    Then create the file 'README.md' inside that folder with -ItemType File and add the text using -Value 'Project Start'.
  3. Final Answer:

    New-Item -Path 'C:\Work\Projects' -ItemType Directory; New-Item -Path 'C:\Work\Projects\README.md' -ItemType File -Value 'Project Start' -> Option A
  4. Quick Check:

    Create folders before files inside them [OK]
Quick Trick: Create folders before files inside them [OK]
Common Mistakes:
  • Creating files before folders exist
  • Mixing up -ItemType File and Directory
  • Adding -Value to folders

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes