On Command Prompt, and its syntactical ancestor, DOS, you can create a text file inline by doing this:
copy con file.txt
Hello World
^Z
Or:
type con > file.txt
Hello World
^Z
Is there an equivalent command in Powershell? Neither of the two commands I listed above work.
cmd /c copy con file.txt
– Businesslikenotepad file.txt
Handy, too, since it shows you the file encoding. – Reasonlesscopy con file
or Linux bycat > file
then pasting into the terminal window, you can useGet-Clipboard > file
under PowerShell. – Epps