VBS 예제: 스크롤백 버퍼 지우고 일련의 명령 결과를 파일에 기록

Sub Main

xsh.Screen.Synchronous = true

' Clear current screen and the terminal's scrollback buffer
xsh.Screen.Send "reset"
xsh.Screen.Send VbCr
xsh.Session.Sleep 100

' start logging
xsh.Session.LogFilePath = "d:\result\1.txt"
xsh.Session.StartLog
xsh.Session.Sleep 100

' Send commands to the server
xsh.Screen.Send "ls -l"&vbcr
xsh.Session.Sleep 100
xsh.Screen.Send "cd ~"&vbcr
xsh.Screen.Send "ls -l"&vbcr
xsh.Screen.Synchronous = false

' Stop logging
xsh.Session.StopLog
End sub