Xshell 腳本包含選擇其他會話的功能。不過,該功能僅在Xshell處於單一進程模式時可用。
1、在【工具】-【選項】-【進階】中勾選【使用單一進程模式以獲得更好的效能】選項,再次執行 Xshell。
在腳本中,在xsh.Session.Open之後使用xsh.Session.SelectTabName(“會話名稱”)函數,然後執行腳本。
xsh.Session.Open(“C:\\Users\\test\\Documents\\NetSarang Computer\\7\\Xshell\\Sessions\\test.xsh”); -> In this case, the session name will be test.
xsh.Screen.Synchronous = true;
xsh.Session.Sleep(1000);
xsh.Session.SelectTabName(“test”)
xsh.Screen.Send(“help”)