[英]Executing the windows batch file
What I am doing currently- 我目前在做什么-
MachineB
from MachineA
(Windows Environment). MachineA
(Windows Environment)在MachineB
上执行shell脚本。 MachineA
(Windows Environment) from MachineB
. MachineA
从(Windows环境下) MachineB
。 So for this I wrote a Windows Batch file
that will do the above task and it is working fine for me. 因此,为此,我编写了一个
Windows Batch file
,它将完成上述任务,并且对我来说工作正常。 Below is the Windows Bat file that I am using currently. 以下是我当前使用的Windows Bat文件。
plink uname@machineB -m email.sh
pscp uname@machineB:/export/home/uname/jk_attachment22.txt C:\PLINK\foo.txt
But by using the above windows batch file, I need to type password two times which is pain, Firstly I need to type for the first line and then again for the second line. 但是通过使用上面的Windows批处理文件,我需要两次键入密码,这很痛苦,首先,我需要在第一行中键入,然后在第二行中再次键入。
My Question is- 我的问题是-
So Is there any way I can run the above windows batch file by just typing password
once at the command prompt. 所以有什么办法可以通过在命令提示符下键入一次
password
来运行上述Windows批处理文件。 Any suggestions will be appreciated. 任何建议将不胜感激。
This is what I have when I was looking for /.ssh folder
. 这是我在寻找
/.ssh folder
。
Update: 更新:
bash-3.00$ cd ~/.ssh
bash-3.00$ pwd
/home/uname/.ssh
bash-3.00$ ls -lt
total 2
-rw-r--r-- 1 uname gid-uname 489 Jul 26 18:55 known_hosts
So I need to make some other changes here? 所以我需要在这里进行其他更改吗?
I'd skip the password and auth with ssh key. 我会跳过密码并使用ssh键进行身份验证。 http://www.debian-administration.org/articles/152
http://www.debian-administration.org/articles/152
Use the -pw option in your command line utilities. 在命令行实用程序中使用-pw选项。
Let's say you name your batch file TWINKIE.BAT. 假设您将批处理文件命名为TWINKIE.BAT。 At the command prompt, you'd type "TWINKIE password", where "password" is the actual password you want to use.
在命令提示符下,键入“ TWINKIE password”,其中“ password”是您要使用的实际密码。
C:\>twinkie password
The "password" is passed into your batch file as the first command line variable, %1. “密码”作为第一个命令行变量%1传递到批处理文件中。 Your batch file would be:
您的批处理文件将是:
plink -pw %1 uname@machineB -m email.sh
pscp -pw %1 uname@machineB:/export/home/uname/jk_attachment22.txt C:\PLINK\foo.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.