I am trying to echo 3 plain-text lines to a file using Powershell:
echo "#Generated" > psftp.scp echo "put test.txt" >> psftp.scp echo "quit" >> psftp.scp I then use psftp.exe batch mode to run the file (executes the commands in SFTP), but psftp errors out seeing an invalid character:
psftp: unknown command " ■#" What am I missing? I can manually type up the file in Windows Notepad and it (psftp) works. No matter what I change the first line to (#Generated) it gets this error with the block symbol in the first part.
I've tried viewing the file in NotePad++ w/ "Show All Symbols" on, but only saw CR & LF at the end of lines which is normal.
Out-Fileyou can use-Appendto add text and-Encodingto specify the correct encoding.