如何用批处理在超级终端自动输入字符串

2024-11-15 10:31:14
推荐回答(1个)
回答1:

用vbs sendkeys
假设你已打开超级终端并命名为aa,将下面的代码另存为st.vbs,双击运行即可。
Dim WshShell
Set WshShell=WScript.CreateObject("WScript.Shell")
WScript.Sleep 200
WshShell.AppActivate "aa - 超级终端"
WScript.Sleep 200
WshShell.SendKeys "{ENTER}“
WScript.Sleep 200
WshShell.SendKeys "EN“
WScript.Sleep 200
WshShell.SendKeys "cisco“
WScript.Sleep 200
WshShell.SendKeys "show{BS}config“

如果一定要批处理的话就吧下面的代码存为st.bat

echo Dim WshShell>st.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell")>>st.vbs
echo WScript.Sleep 200>>st.vbs



echo WshShell.SendKeys "show{BS}config“>>st.vbs
st
del st.vbs