I am wring a script using VBScript. This script needs to run in CMD and connect to a system with Linux OS. I need to use the cut
command to take a specific number. When I am trying to send %
via the script it sends .
Any ides?
This is the code:
oShell.SendKeys "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt"
When I use my code in secureCRT it's working. When I copy the line and paste manually in CMD line it's working too. It's not working when trying to run it automatclly.
When in doubt, read the documentation .
The SendKeys method uses some characters as modifiers of characters (instead of using their face-values). This set of special characters consists of parentheses, brackets, braces, and the:
plus sign
+
,
caret^
,
percent sign%
,
and tilde~
Send these characters by enclosing them within braces "{}". For example, to send the plus sign, send the string argument "{+}".
Change this:
oShell.SendKeys "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt"
into this:
oShell.SendKeys "cat /tmp/dftemp1.txt | cut -d'{%}' -f1 > /tmp/dftemp2.txt"
Or , use something like plink
(from the PuTTY suite ), so you don't need to fiddle around with SendKeys
in the first place.
plink user@host "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.