gpt4 book ai didi

powershell - 将内容输入文本文件的脚本

转载 作者:行者123 更新时间:2023-12-03 11:49:10 26 4
gpt4 key购买 nike

如何在不通过 Windows 上的脚本打开的情况下将一些“文本”包含到 .txt 格式文件中?

最佳答案

我会给你一个全 PowerShell 的答案。您可以使用 Add-ContentSet-Content cmdlet。

Set-Content 覆盖目标文件,Add-Content 附加到文件。

Set-Content -Value "Test1" -Path C:\Scripts\Scratch\test.txt
Add-Content -Value "Test" -Path C:\Scripts\Scratch\test.txt

或者,您也可以使用 Out-File .
"Test" | Out-File -FilePath C:\Scripts\Scratch\test.txt -Append

关于powershell - 将内容输入文本文件的脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5120393/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com