Bird
0
0

What will be the result of this command?

medium📝 Command Output Q5 of 15
PowerShell - File and Directory Operations
What will be the result of this command?
$data = Import-Csv -Path users.csv
$data | Export-Csv -Path newusers.csv -NoTypeInformation

Assuming users.csv exists and is valid.
ACreates newusers.csv with same data as users.csv without type info
BThrows an error because Export-Csv cannot accept pipeline input
CCreates newusers.csv but includes type information header
DDeletes users.csv and creates newusers.csv
Step-by-Step Solution
Solution:
  1. Step 1: Import CSV into $data

    The Import-Csv cmdlet reads users.csv into $data as objects.
  2. Step 2: Export $data to newusers.csv without type info

    Export-Csv writes the objects to newusers.csv, and -NoTypeInformation omits type header.
  3. Final Answer:

    Creates newusers.csv with same data as users.csv without type info -> Option A
  4. Quick Check:

    Export-Csv accepts pipeline input and -NoTypeInformation omits type [OK]
Quick Trick: Use -NoTypeInformation to skip type header in CSV [OK]
Common Mistakes:
  • Thinking Export-Csv can't take pipeline input
  • Expecting type info header by default
  • Assuming file deletion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes