
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Export and import CSV file manually in PowerShell?
When you run a command Export-Csv in PowerShell, it automatically creates a CSV file to the specific location.
Example
Get-Service | Select Name, Starttype, Status | Export-Csv C:\temp\services.csv -NoTypeInformation
In the above example, Services.csv file created in C:\Temp folders with the header Name, Starttype, and Status headers.
Similarly, you can use the other commands to get the output into the CSV file format.
If you want to check this file from the PowerShell console, you need to use Import-CSV command.
Import-Csv C:\temp\Services.csv | ft -Autosize
Output
Name StartType Status ---- --------- ------ AarSvc_7a82a Manual Stopped AdobeARMservice Automatic Running AdobeFlashPlayerUpdateSvc Manual Stopped AJRouter Manual Stopped ALG Manual Stopped AppIDSvc Manual Stopped Appinfo Manual Running AppMgmt Manual Stopped AppReadiness Manual Stopped AppVClient Disabled Stopped AppXSvc Manual Stopped AssignedAccessManagerSvc Manual Stopped AudioEndpointBuilder Automatic Running
If you need only Name and Status then you can use Select command after pipeline
Import-Csv C:\temp\Services.csv | Select Name,Status
Output
Name Status ---- ------ AarSvc_7a82a Stopped AdobeARMservice Running AdobeFlashPlayerUpdateSvc Stopped AJRouter Stopped ALG Stopped AppIDSvc Stopped Appinfo Running AppMgmt Stopped AppReadiness Stopped AppVClient Stopped AppXSvc Stopped
- Related Questions & Answers
- How to create a CSV file manually in PowerShell?
- How to import csv file in PHP?
- How to import csv file data from Github in R?
- How to convert JSON file to CSV file using PowerShell?
- How to edit the CSV file using PowerShell?
- How to retrieve CSV file headers using PowerShell?
- Importing / Exporting CSV file in PowerShell
- How to convert JSON to CSV file using PowerShell?
- How to import and export a module/library in JavaScript?
- How can we import data from .CSV file into MySQL table?
- How to append data into a CSV file using PowerShell?
- Python Tkinter – How to export data from Entry Fields to a CSV file?
- How to export output to excel in PowerShell?
- How can we export all the data from MySQL table into a CSV file?
- How can we export some field(s) from MySQL table into a CSV file?
Advertisements