Bird
0
0

You have a script that deletes multiple files. If a file is missing, you want to ignore the error and continue deleting other files without any error messages. Which -ErrorAction value should you use?

hard📝 Application Q8 of 15
PowerShell - Error Handling
You have a script that deletes multiple files. If a file is missing, you want to ignore the error and continue deleting other files without any error messages. Which -ErrorAction value should you use?
AInquire
BStop
CContinue
DSilentlyContinue
Step-by-Step Solution
Solution:
  1. Step 1: Understand the scenario

    The script deletes multiple files and should skip missing files silently.
  2. Step 2: Choose the appropriate ErrorAction value

    SilentlyContinue suppresses error messages and continues execution.
  3. Final Answer:

    SilentlyContinue -> Option D
  4. Quick Check:

    Suppress errors and continue silently with SilentlyContinue [OK]
Quick Trick: Use SilentlyContinue to skip errors without messages [OK]
Common Mistakes:
  • Using Stop which halts the script on error
  • Using Continue which shows errors but continues
  • Using Inquire which prompts user on errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes