Bird
0
0

What does the PowerShell command Test-Path 'C:\Temp' do?

easy📝 Conceptual Q1 of 15
PowerShell - File and Directory Operations
What does the PowerShell command Test-Path 'C:\Temp' do?
ADeletes the directory 'C:\Temp'
BCreates the directory 'C:\Temp'
CChecks if the path 'C:\Temp' exists
DLists all files in 'C:\Temp'
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of Test-Path

    Test-Path checks if a file or directory exists at the specified path.
  2. Step 2: Apply to the given path 'C:\Temp'

    The command checks if the directory or file at 'C:\Temp' exists and returns True or False.
  3. Final Answer:

    Checks if the path 'C:\Temp' exists -> Option C
  4. Quick Check:

    Test-Path usage = Checks existence [OK]
Quick Trick: Test-Path returns True if path exists, else False [OK]
Common Mistakes:
  • Thinking Test-Path creates or deletes files
  • Confusing Test-Path with Get-ChildItem

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes