使用 operator(%) 作为字符串时遇到问题
Having problem using an operator(%) as a string
我有一个批处理文件,其中 运行 是 Telnet 的 vbscript:
Option explicit
Dim oShell, str
set oShell = Wscript.CreateObject("WScript.Shell")
oShell.Sendkeys "o confidential ip~"
WScript.Sleep 1000
str = "\%"
oShell.Sendkeys "E" & str & ".~"
WScript.Sleep 1000
oShell.Sendkeys ".%c13,0;0.3.1%y~"
WScript.Sleep 1000
oShell.Sendkeys "~"
当我 运行 批处理文件时,%
字符消失并仅执行
E.
.c13,0;0.3.1y
我希望 %
在连接到 telnet 后用作字符串。我什么都试过了,好像没用。
请帮忙
如前所述here:
The plus sign "+", caret "^", percent sign "%", tilde "~", and parentheses "()" all have special meanings and must be enclosed within braces "{}".
所以你应该注意,例如 %
应该用作 'sendkey' 字符串中的文字,用大括号括起来,例如 {%}
.
我有一个批处理文件,其中 运行 是 Telnet 的 vbscript:
Option explicit
Dim oShell, str
set oShell = Wscript.CreateObject("WScript.Shell")
oShell.Sendkeys "o confidential ip~"
WScript.Sleep 1000
str = "\%"
oShell.Sendkeys "E" & str & ".~"
WScript.Sleep 1000
oShell.Sendkeys ".%c13,0;0.3.1%y~"
WScript.Sleep 1000
oShell.Sendkeys "~"
当我 运行 批处理文件时,%
字符消失并仅执行
E.
.c13,0;0.3.1y
我希望 %
在连接到 telnet 后用作字符串。我什么都试过了,好像没用。
请帮忙
如前所述here:
The plus sign "+", caret "^", percent sign "%", tilde "~", and parentheses "()" all have special meanings and must be enclosed within braces "{}".
所以你应该注意,例如 %
应该用作 'sendkey' 字符串中的文字,用大括号括起来,例如 {%}
.