This article introduces how to create and write files simultaneously in PowerShell.
In Bash, You Can Do It with the cat Command and Heredoc
In bash,
cat << EOT > file.md
hoge
hoge
EOT
You can do it like this, but I want to do this in PowerShell.
PowerShell Heredoc
echo @"
hoge
$fuga
piyo
"@
You can write heredocs by enclosing double quotes or single quotes with @. Newlines are required before and after the opening and closing @.## How to Do It Use
Set-Content. There's also Add-Content, but that hasn't been tested.
```
Set-Content -Path "_dev.md" -Force -Value @'
hoge
fuga
'@
```
With this, a file with text is created in the current directory.