[英]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. bat文件,并且该路径应该是要将文件从本地放置到的目标位置。
My code looks like this: 我的代码如下所示:
Getfile.bat: Getfile.bat:
set /P INPUT=Type input: psftp <user>@<IP> -b D:\\FileTransfer.bat -pw <PW>
Filetransfer.bat: 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 错误:访问被拒绝远程工作目录为/ home / irisuser目录/ home / irisuser /%INPUT%:无此类文件或目录
Your variable %INPUT%
is not passed to Filetransfer.bat
. 您的变量%INPUT%
不会传递到Filetransfer.bat
。 If you want psftp
to cd
into a user-defined directory, you have to create Filetransfer.bat
on the fly: 如果要将psftp
cd
到用户定义的目录中,则必须动态创建Filetransfer.bat
:
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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.