问题描述
我想使用pscp
(从腻子中)从Windows PC复制一些文件到远程Linux系统.我编写了一个小脚本,以这种方式调用pscp命令:
I want to copy some file to a remote Linux system from my Windows PC using pscp
(from putty). I wrote a small script that call the pscp commands in this way:
"C:\Users\hp\Desktop\pscp.exe" -scp C:\Users\hp\Desktop\scripts\* [email protected]:/root/scripts
"C:\Users\hp\Desktop\pscp.exe" -scp C:\Users\hp\Desktop\scripts2\* [email protected]:/root/scripts2
pause
但是,当我启动此bat脚本时,要求输入密码,因此我手动输入了密码.
But when I launch this bat script, I'm asked to input the password, so I input the password manually.
是否可以通过批处理文件自动输入密码?
Is there a way to input the password automatically through the batch file?
推荐答案
来自腻子文档
如果需要密码才能连接到主机,PSCP将 以交互方式提示您.但是,这可能并不总是 合适的.如果您正在将PSCP作为某些自动化作业的一部分运行,则它将 将无法手动输入密码. -pw选项 PSCP允许您在命令行上指定要使用的密码.
If a password is required to connect to the host, PSCP will interactively prompt you for it. However, this may not always be appropriate. If you are running PSCP as part of some automated job, it will not be possible to enter a password by hand. The -pw option to PSCP lets you specify the password to use on the command line.
这篇关于自动输入pscp密码的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!