sftp failed to recognize commands in a batch file
-
- Posts: 3
- Joined: Tue Jun 16, 2020 7:42 am
sftp failed to recognize commands in a batch file
I run sftp -b batch_file.txt myid@myserver.com in a Window powershell or cmd but it responded with a 'invalid command'. The batch_file.txt contains just ls and pwd. These are legal commands. It appears sftp only read the first character and interpreted that as the command since the error message says 'l invalid command'. If I run sftp -b - myid@myserver.com, which means getting input from stdin, then it can understand commands that I typed
Re: sftp failed to recognize commands in a batch file
I'm not sure what the problem here is, but as described there seems to be something wrong with how you are using the Windows sftp client.
- Does it work with -b batch mode to another ssh/sftp server?
-- if not, then I suggest that you check with powershell openssh support areas
- Does it work with -b batch mode to another ssh/sftp server?
-- if not, then I suggest that you check with powershell openssh support areas
-
- Posts: 3
- Joined: Tue Jun 16, 2020 7:42 am
Re: sftp failed to recognize commands in a batch file
I found the issue; it has to do with encoding (e.g. UTF-8). If the text is not created in UTF-8, server will reject it even though you have no clue why (i.e. can't see what is wrong with the text)