Powershell-向文件追加内容

第2步

将内容添加到 test.txt

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

Cmdlet

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

步骤1

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

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

第3步

读取test.txt的内容

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

输出

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

Hello
World!
日期:2019-08-20 13:51:04 来源:oir作者:oir