문제 설명
사용자 입력 경로 psftp 스크립트 배치 파일 (User input path psftp script batch file)
I am trying to implement a scenerio like the user should give a path and the path should be binded to another .
bat file and that path should be the destination where am going to put my file from local.
My code looks like this:
Getfile.bat:
set /P INPUT=Type input: psftp <user>@<IP> ‑b D:\FileTransfer.bat ‑pw <PW>
Filetransfer.bat:
cd %INPUT% lcd d:\ put log.sh
Error :Access denied Remote working directory is /home/irisuser Directory /home/irisuser/%INPUT%: no such file or directory
참조 솔루션
방법 1:
Your variable %INPUT%
is not passed to Filetransfer.bat
. If you want psftp
to cd
into a user‑defined directory, you have to create Filetransfer.bat
on the fly:
set /P INPUT=Type input:
>D:\Filetransfer.bat echo.cd %INPUT%
>>D:\Filetransfer.bat echo.lcd d:\
>>D:\Filetransfer.bat echo.put log.sh
psftp <user>@<IP> ‑b D:\FileTransfer.bat ‑pw <PW>
(by suresh、Ansgar Wiechers)