Execute external command using JS in SM

Placeholder Image

The below script will help you to execute the Command Prompt commands in HP SM using JS:

Example: we will run the command DIR, then this is how we follow:


function runCMD() {
var execString = “echo 1. dir INSTALL HOME: > C:/test.txt”;
var rc = sysExec(execString);
var execString = “dir C: >> C:/test.txt”;
var rc = sysExec(execString);
if (rc[0] == 0 && rc[1] == 0) {
print(“RunCMD successfully.”)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s