带有示例的PowerShell Export-CSV命令教程

本文是一篇关于PowerShell Export-CSV命令的教程,详细介绍了如何导出到CSV文件,设置分隔符,选择写入属性,附加到现有文件,不覆盖文件,覆盖只读文件以及设置CSV文件编码等操作。
摘要由CSDN通过智能技术生成

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 ValueCSV文件是一种非常流行的文本文件,用于不同目的。 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
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值