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
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.