gpt4 book ai didi

batch-file - 自动输入pscp密码的命令

转载 作者:行者123 更新时间:2023-12-03 08:22:09 31 4
gpt4 key购买 nike

我想使用pscp(来自腻子)从Windows PC将某些文件复制到远程Linux系统。我编写了一个小脚本,以这种方式调用pscp命令:

"C:\Users\hp\Desktop\pscp.exe" -scp C:\Users\hp\Desktop\scripts\* root@192.168.1.177:/root/scripts
"C:\Users\hp\Desktop\pscp.exe" -scp C:\Users\hp\Desktop\scripts2\* root@192.168.1.177:/root/scripts2

pause

但是,当我启动此bat脚本时,要求输入密码,因此我手动输入了密码。

有没有办法通过批处理文件自动输入密码?

最佳答案

从腻子documentation

5.2.2.6 -pw passw login with specified password

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.

关于batch-file - 自动输入pscp密码的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23080097/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com