Command-separated Value
or CSV
files are a very popular type of text files which are used for different purposes. What makes CSV special is the ability to store structured data by delimiting the values or columns with comma. CSV files are compatible with Excel files to import and export.
Command-separated Value
或CSV
文件是一种非常流行的文本文件,用于不同目的。 CSV的特殊之处在于它能够通过用逗号分隔值或列来存储结构化数据。 CSV文件与导入和导出的Excel文件兼容。
导出到逗号分隔的CSV文件 (Export To Comma Delimited CSV File)
We will start with a simple example. Get-Process
command is used to list currently running proccesses with different information like Handle, NPM, CPU,ID, ProcessName etc. We can use the command Export-CSV in order to store these process information delimited with command.
我们将从一个简单的例子开始。 Get-Process
命令用于列出当前运行Get-Process
具有不同的信息,例如Handle,NPM,CPU,ID,ProcessName等。我们可以使用Export-CSV命令来存储这些用命令定界的过程信息。
PS> Get-Process
Now we can put these running processes information into a CSV file by redirecting Get-Process output. We will provide the file name with the option -Path
. The file name will be ProcessList.csv.
现在,我们可以通过重定向Get-Process输出将这些正在运行的进程信息放入CSV文件中。 我们将为文件名提供-Path
选项。 文件名将为ProcessList.csv。
PS> Get-Process | Export-CSV -Path ProcessList.csv