How do I include some "text" into a .txt format file without opening the same via a script on Windows?
I will give you an all PowerShell answer. You can use Add-Content or Set-Content cmdlets.
Set-Content overwrites the target file and Add-Content appends to the file.
Set-Content -Value "Test1" -Path C:\Scripts\Scratch\test.txt
Add-Content -Value "Test" -Path C:\Scripts\Scratch\test.txt
Or, you can also use Out-File.
"Test" | Out-File -FilePath C:\Scripts\Scratch\test.txt -Append