Bird
0
0

What will be the output of this PowerShell command?

medium📝 Command Output Q13 of 15
PowerShell - File and Directory Operations
What will be the output of this PowerShell command?
New-Item -Path 'C:\Temp\log.txt' -ItemType File -Value 'Start Log'
AThrows an error because -Value is not valid
BCreates an empty file 'log.txt' in C:\Temp
CCreates a file 'log.txt' with content 'Start Log' in C:\Temp
DCreates a folder named 'log.txt' in C:\Temp
Step-by-Step Solution
Solution:
  1. Step 1: Understand the command parameters

    The command uses -ItemType File to create a file and -Value 'Start Log' to add initial content.
  2. Step 2: Analyze the expected result

    The file 'log.txt' will be created inside C:\Temp with the text 'Start Log' inside it.
  3. Final Answer:

    Creates a file 'log.txt' with content 'Start Log' in C:\Temp -> Option C
  4. Quick Check:

    -Value adds content to new files [OK]
Quick Trick: Use -Value to add content when creating files [OK]
Common Mistakes:
  • Assuming -Value is invalid
  • Confusing file creation with folder creation
  • Expecting empty file when -Value is used

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes