View Single Post
Old 01-19-2006, 10:08 AM
tnygren's Avatar
tnygren tnygren is offline
Registered User
Join Date: May 2005
Posts: 1,408
Hi Gamma,

This is possible using the scripting objects in SecureCRT.

I have provided an example VBscript below that will start a session and run a command.

The script does need the SecureCRT window to be already open but it sounded like you have already created that portion of the script.

#$language = "VBScript"
#$interface = "1.0"
Option Explicit

' Modify the g_szCommand string below to send the command you want
' Modify the g_szSession to the session name that needs to be connected to
Dim g_szCommand, g_szPrompt, g_szSession

g_szSession = "redhat"
g_szCommand = "ps -auuux | grep $USER" & vbcr
g_szPrompt  = "->"

Sub Main()

    ' Connect to the session

    crt.Session.Connect("/S " & chr(34) & g_szSession & chr(34))

    ' Issue the command that will generate the output that we are looking for
    crt.Screen.Send g_szCommand

    ' Wait for the command to finish (the prompt will appear when the command
    ' is done)

    ' Now Quit SecureCRT
    crt.Sleep 250

End Sub
To start this script from the SecureCRT command line, just add the following to the SecureCRT command line:

SecureCRT.exe /Script <full path to script file\script name>

Was this the information that you needed?


Teresa Nygren

Last edited by tnygren; 01-19-2006 at 02:29 PM.