自动输入pscp密码的命令 [英] Command to automatically input password for pscp

查看:880
本文介绍了自动输入pscp密码的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用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\* 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脚本时,要求输入密码,因此我手动输入了密码.

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?

推荐答案

来自腻子文档

5.2.2.6 -pw passw 使用指定的密码登录

5.2.2.6 -pw passw login with specified password

如果需要密码才能连接到主机,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密码的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆