Bird
0
0

What will happen when this PowerShell command runs?

medium📝 Command Output Q5 of 15
PowerShell - File and Directory Operations
What will happen when this PowerShell command runs?
Move-Item -Path 'C:\Temp\report.docx' -Destination 'C:\Archive' -WhatIf
ADeletes the file from C:\Temp
BMoves the file to C:\Archive immediately
CShows what would happen without moving the file
DThrows an error because -WhatIf is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Understand the -WhatIf parameter

    -WhatIf simulates the command, showing the action without executing it.
  2. Step 2: Apply to Move-Item

    The command will display the move operation but will not move or delete the file.
  3. Final Answer:

    Shows what would happen without moving the file -> Option C
  4. Quick Check:

    -WhatIf simulates command execution [OK]
Quick Trick: Use -WhatIf to preview actions without changes [OK]
Common Mistakes:
  • Expecting the file to move with -WhatIf
  • Confusing -WhatIf with -Confirm
  • Thinking -WhatIf causes errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes