在剪切命令中发送“%”(linux)
send '%' in cut command (linux)
我正在使用 VBScript 编写脚本。此脚本需要在 CMD 中 运行 并使用 Linux OS 连接到系统。我需要使用 cut
命令来取一个特定的数字。当我尝试通过脚本发送 %
时,它会发送 </code>.</p>
<p>有什么想法吗?</p>
<p>这是代码:</p>
<pre><code>oShell.SendKeys "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt"
当我在 secureCRT 中使用我的代码时,它工作正常。当我复制该行并在 CMD 行中手动粘贴时,它也能正常工作。尝试自动 运行 时它不起作用。
如有疑问,请阅读 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 "{+}".
改变这个:
oShell.SendKeys "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt"
进入这个:
oShell.SendKeys "cat /tmp/dftemp1.txt | cut -d'{%}' -f1 > /tmp/dftemp2.txt"
或,使用类似plink
(from the PuTTY suite)的东西,所以你不需要首先fiddle和SendKeys
.
plink user@host "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt"
我正在使用 VBScript 编写脚本。此脚本需要在 CMD 中 运行 并使用 Linux OS 连接到系统。我需要使用 cut
命令来取一个特定的数字。当我尝试通过脚本发送 %
时,它会发送 </code>.</p>
<p>有什么想法吗?</p>
<p>这是代码:</p>
<pre><code>oShell.SendKeys "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt"
当我在 secureCRT 中使用我的代码时,它工作正常。当我复制该行并在 CMD 行中手动粘贴时,它也能正常工作。尝试自动 运行 时它不起作用。
如有疑问,请阅读 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 "{+}".
改变这个:
oShell.SendKeys "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt"
进入这个:
oShell.SendKeys "cat /tmp/dftemp1.txt | cut -d'{%}' -f1 > /tmp/dftemp2.txt"
或,使用类似plink
(from the PuTTY suite)的东西,所以你不需要首先fiddle和SendKeys
.
plink user@host "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt"