如果我已经在配置文件中指定了主机,那么是否有任何方法可以使用-load profile通过pscp发送文件而不指定主机?
我只想指定源路径、目标路径和配置文件,而不指定用户和主机,因为它已经在配置文件中了。
示例:我希望在批处理中创建脚本,该脚本将从作为第二个参数提供的第一个参数文件的配置文件发送到主机根目录:
@echo off
pscp.exe -load %* SOMETHING:/
pause但我不知道该放什么代替SOMETHING。我需要这个脚本来创建Windows8.1中的“发送到菜单”条目(在“发送到菜单”中的Windows快捷方式不能接受%1、%2、%*等,所以我必须创建脚本来重新排列pscp中的参数顺序。
发布于 2014-12-20 14:43:43
如果我理解正确的话:
是这样的吗?
如果是,这样的BAT文件:
@echo off
pscp c:/tce-test.tce imac:/tmp
pause将本地windows c:\tcp-test.tce文件复制到putty "imac“配置文件中指定的远程主机,用相同的"imac”putty配置文件中指定的用户名连接到该主机,并将该文件写入远程/tmp文件夹。
换句话说,正如pscp文档明确指出的那样
5.2.1.2 host
The name of the remote server, or the name of an existing PuTTY saved session. In the
latter case, the session's settings for hostname, port number, cipher type and username
will be used.您可以使用保存的putty会话的名称代替主机参数。这正是你需要的。
在提出上述各点后,我想补充以下考虑:
出发地:官方腻子文档:
3.8.3.18 -i: specify an SSH private key
The -i option allows you to specify the name of a private key file in *.PPK
format which PuTTY will use to authenticate with the server. This option is only
meaningful if you are using SSH.
For general information on public-key authentication, see chapter 8.
This option is equivalent to the ‘Private key file for authentication’ box in the Auth
panel of the PuTTY configuration box (see section 4.20.7).https://serverfault.com/questions/653790
复制相似问题