如何使用vbscript在命令提示符下输入密码

时间:2014-11-26 13:34:05

标签: vbscript

我已经编写了vb脚本代码,使用putty PSCP命令将文件从Windows复制到Linux

Dim objShell
Set objShell = WScript.CreateObject ("WScript.shell")
objShell.run "cmd /K pscp.exe c:\temp\sunset.jpg tokunbo@my-ipaddress:/home/tokunbo"
Set objShell = Nothing

当我在脚本上面运行时,我在命令promt中获得tokunbo @ my-ipaddress密码:选项。我的问题如何编写代码在vbscript的命令提示符下输入密码。请帮忙

1 个答案:

答案 0 :(得分:1)

如有疑问,请阅读documentation

Usage: pscp [options] [user@]host:source target
       pscp [options] source [source...] [user@]host:target
       pscp [options] -ls [user@]host:filespec
Options:
  -V        print version information and exit
  -pgpfp    print PGP key fingerprints and exit
  -p        preserve file attributes
  -q        quiet, don't show statistics
  -r        copy directories recursively
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -P port   connect to specified port
  -l user   connect with specified username
  -pw passw login with specified password
  -1 -2     force use of particular SSH protocol version
  -4 -6     force use of IPv4 or IPv6
  -C        enable compression
  -i key    private key file for authentication
  -noagent  disable use of Pageant
  -agent    enable use of Pageant
  -batch    disable all interactive prompts
  -unsafe   allow server-side wildcards (DANGEROUS)
  -sftp     force use of SFTP protocol
  -scp      force use of SCP protocol

但是,我建议使用public key authentication代替密码验证。