VBS预期声明错误

时间:2014-07-16 16:29:51

标签: vbscript compiler-errors

我一直收到错误预期声明。代码800A0400。第1行,char 1.我做错了什么?

我的代码,

# $language = "VBScript"
 # $interface = "1.0"

' Connect to an SSH server using the SSH2 protocol. Specify the
' username and password and hostname on the command line as well as
' some SSH2 protocol specific options.

 Sub Main

  Dim host
  host = "ssh.google.com"
  Dim user
  user = "userinfo"

  ' Prompt for a password instead of embedding it in a script...
  '
  Dim passwd
  passwd = crt.Dialog.Prompt("Enter password for " & host, "Login", "", True)

  ' Build a command-line string to pass to the Connect method.
  '
  cmd = "/SSH2 /L " & user & " /PASSWORD " & passwd & " /C 3DES /M MD5 " & host

  crt.Session.Connect cmd

  End Sub

1 个答案:

答案 0 :(得分:2)

"评论到行尾" VBScript中的标记是单引号',而不是#。所以改变

# $language = "VBScript"
 # $interface = "1.0"

' $language = "VBScript"
' $interface = "1.0"

(其他可能的问题:你打电话 Sub main?crt来自哪里?)