問題描述
psftp 批處理腳本不起作用 (psftp batch script won't work)
I'm trying to run a .bat file from windows xp using putty sftp. My code is below. For some reason, I keep getting an "access denied".
The annoying thing is that when I copy>paste these into the cmd prompt line by line, it works fine! I'm not sure if there's still some error with my code or if it's possible that the ftpsite.com won't accept incoming messages from a batch file?
@echo off
psftp user@ftp.ftpsite.com ‑pw abc#!123
cd Data/out
get file.csv
‑‑‑‑‑
參考解法
方法 1:
Commands to PSFTP must be placed in a SCRIPT file as in:
Filename: myscript.scr
cd Data/out
get file.csv
exit
Then you call it with:
@echo off
psftp user@ftp.ftpsite.com ‑pw abc#!123 ‑b myscript.scr
(by user2032924、Neal)