> For the complete documentation index, see [llms.txt](https://www.shellspells.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.shellspells.net/windows/file-ops/modify-content/overwrite.md).

# Overwrite

<table data-header-hidden data-full-width="true"><thead><tr><th width="568">Command</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:yellow;"><code>echo "Text to add" > C:\file.txt</code></mark></td><td>Create/overwrite</td></tr><tr><td><mark style="color:yellow;"><code>Set-Content -Path C:\file.txt -Value "Text"</code></mark></td><td>Create/Overwrite</td></tr><tr><td><mark style="color:yellow;"><code>"Text to add" | Set-Content C:\file.txt</code></mark></td><td>Create/Overwrite</td></tr><tr><td><mark style="color:yellow;"><code>[System.IO.File]::WriteAllText("C:\file.txt", "Text")</code></mark></td><td>Overwrite using .NET</td></tr><tr><td><mark style="color:yellow;"><code>echo.> C:\file.txt</code></mark></td><td>Clear content</td></tr><tr><td><mark style="color:yellow;"><code>type NUL > file.txt</code></mark></td><td>Create empty file or clear file</td></tr></tbody></table>
