Scripting Examples

Example Scripts for SecureCRT® for Windows

These example scripts, written in VBScript, JScript, and PerlScript, show how to perform specific tasks using the script execution capabilities of SecureCRT for Windows. You can use the examples as guides to writing your own scripts.

The scripts are collected in one self-extracting EXE file, which you can download by clicking on the link below:

example_scripts.exe (48K)

Listed below are summaries of the scripts in the file.

For more information on scripts and scripting methods, see the Scripting FAQ and the VanDyke Software online Scripting Essentials guide.

Connecting From Within a Script

Connect to a server using a pre-defined session (JScript).
Connect with SecureCRT using the SSH2 protocol (VBScript).
Connect using the Telnet protocol and automate login (VBScript).

Sending Commands and Data To a Server

Opens a file and sends its contents line by line (VBScript and JScript respectively).
Opens a file and does some processing of the text before sending it (VBScript).
Uploads a text file to a server by sending it line by line and directing output to a file (VBScript).
SetEnv.vbs Automates setting the DISPLAY shell variable to enable remote display of X clients (VBScript).
SetLinesCols.vbs Automates setting the LINES and COLUMNS shell variables for terminal environments where these variables are not set properly (VBScript).
SendFKey.vbs Simulates pressing a function key (VBScript).

Retrieving Output From a Server

GetData.vbs Demonstrates use of the Get() function to read data from the screen (VBScript).
GetDataToExcel.vbs Uses the Get() function to read data from the screen and uses OLE automation to write data to an Excel file (VBScript).
GetDataToFile.vbs Uses the Get() function to read data from the screen and write it to a text file (VBScript).

User Interface Functions

Demonstrates the various uses and options of the MessageBox() function (VBScript and JScript).
Demonstrates the use of the Prompt() function (VBScript and JScript).

Sharing Script Code

These paired scripts show a convenient way of structuring both VBScript and JScript code so that common functions can be reused or shared by more than one script (VBScript and JScript).

Miscellaneous Scripts

WinEnv.vbs Retrieves some Windows user environment variables via Windows Scripting Host (WSH) (VBScript).
Runs an external program from a session via WSH (VBScript and JScript).
RunWord.vbs Run MS Word via Word's OLE automation interface (VBScript).
StartLogfile.vbs Sets the logfile name and enables logging from a script (VBScript). Simple login script (PerlScript). Logs on to several UNIX servers to run some commands (PerlScript).

VanDyke Software uses cookies to give you the best online experience. Before continuing to use this site, please confirm that you agree to our use of cookies. Please see our Cookie Usage for details.