Bird
0
0

You run this command but get an error:

medium📝 Debug Q14 of 15
PowerShell - File and Directory Operations
You run this command but get an error:
Get-ChildItem -Recurse -File -Folder
What is the problem?
AGet-ChildItem does not support -File parameter
BThe -Recurse parameter is invalid
CThe command is missing a path argument
DYou cannot use both -File and -Folder together
Step-by-Step Solution
Solution:
  1. Step 1: Check parameter compatibility

    -Folder is not a valid parameter; the correct parameter for folders is -Directory. Also, -File and -Directory cannot be used together because they filter mutually exclusive items.
  2. Step 2: Identify the error cause

    Using -File and -Folder together causes a parameter conflict error.
  3. Final Answer:

    You cannot use both -File and -Folder together -> Option D
  4. Quick Check:

    -File and -Directory are exclusive = A [OK]
Quick Trick: Use either -File or -Directory, not both together [OK]
Common Mistakes:
  • Using -Folder instead of -Directory
  • Trying to combine -File and -Directory
  • Assuming -Recurse causes the error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes