WshShell Object

Applies to TestComplete 15.65, last modified on July 17, 2024


The WshShell object provides access to the native Windows Shell. It is similar to the Sys.OleObject["WScript.Shell"] object and fully inherits its features.

For a detailed reference on WshShell methods and properties, see the WshShell Object article in the MSDN Library.


Below is a sample script that demonstrates how you can use the WshShell object to run PowerShell scripts and commands from TestComplete tests.

JavaScript, JScript

// Run a script
WshShell.Run("powershell -file C:\\MyScript.ps1");

// Run one command
WshShell.Run("powershell -command echo Test");


# Run a script
WshShell.Run("powershell -file C:\\MyScript.ps1")

# Run one command
WshShell.Run("powershell -command echo Test")


' Run a script
Call WshShell.Run("powershell -file C:\MyScript.ps1")

' Run one command
Call WshShell.Run("powershell -command echo Test")


// Run a script
WshShell.Run('powershell -file C:\MyScript.ps1');

// Run one command
WshShell.Run('powershell -command echo Test');

C++Script, C#Script

// Run a script
WshShell["Run"]("powershell -file C:\\MyScript.ps1");

// Run one command
WshShell["Run"]("powershell -command echo Test");

See Also

Running PowerShell Scripts From TestComplete
Script Extensions
Creating Runtime Objects Tutorial

Highlight search results