Powershell-向文件追加内容

时间:2019-08-20 13:51:04  来源:igfitidea点击:

Cmdlet

Add-Content cmdlet可用于给文件添加内容。

步骤1

在PowerShell ISE控制台中键入以下命令

Set-Content D:\temp\test\test.txt 'Hello'

第2步

将内容添加到 test.txt

Add-Content D:\temp\test\test.txt 'World!'

第3步

读取test.txt的内容

Get-Content D:\temp\test\test.txt

输出

我们可以在PowerShell控制台中看到以下输出。

Hello
World!