---
description: This tutorial explains how to record script in QTP and learn QTP step by step
title: "Understand SystemUtil.Run, SetSecure, Set, Type: QTP/UFT"
image: https://www.guru99.com/images/understand-systemutil-run-setsecure-set-type.png
---

[Skip to content](#main)

**⚡ Smart Summary**

SystemUtil.Run is the UFT One command that launches a file or an application at the start of a run session, while Set, SetSecure and Type feed values and keystrokes into the window it opens.

- 🔘 **Automatic insertion:** Launching an application from the Windows Start menu during recording makes UFT One write the SystemUtil.Run step for you.
- ☑️ **Five arguments:** Run accepts file, params, dir, op and mode, so one statement can open, edit, explore, find or print a target.
- ✅ **Set versus Type:** Set writes a value straight into a field, while Type sends raw keystrokes such as micTab that a human would need.
- 🧪 **SetSecure passwords:** Recorded passwords are stored as encoded strings that cannot be turned back into the original text.
- 🛠️ **Password Encoder:** The Password Encoder GUI and CryptonCMD.exe produce the same encoded strings outside a recording session.
- 📌 **Current naming:** QTP is now OpenText Functional Testing (UFT One), and SystemUtil.Run replaces the legacy InvokeApplication statement.

Read More

![SystemUtil.Run, SetSecure, Set and Type statements in a QTP/UFT One script](https://www.guru99.com/images/understand-systemutil-run-setsecure-set-type.png)

## SystemUtil.Run in UFT

Every recorded GUI test needs a first step that brings the application under test on screen. In OpenText Functional Testing (UFT One, formerly Micro Focus UFT and originally HP QTP), that step is **SystemUtil.Run**. Let’s understand the following piece of code

```
SystemUtil.Run "C:\Program Files\HP\samples\flight\app\flight.exe"
Dialog("Login").WinEdit("Agent Name:").Set "Guru"
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure "4af272a62666d2e"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
```

- The first step is the **SystemUtil.Run Command which is used by default by UFT/QTP to open an application.** During recording, using the Windows Start Menu, we navigated to the “ [Flight Reservation](https://www.guru99.com/uft-qtp-flight-reservation.html)” application. At that time, Micro Focus UFT identified the location of its executable file and inserted the SystemUtil.Run Command to Open it.
- Line 2 is Setting Agent Name as Guru as shown in the Active Screen
- Line 3 is Pressing the Tab key on a keyboard to bring Focus from Agent Name Field To Password Field, which is exactly this step. **Human users need to use tab or click operations to focus on a particular object on screen. On the other hand, [Quick Test](https://www.guru99.com/uft-qtp-automation-testing.html) can directly identify an object using object properties and does not require these “maneuvering” operations**. We can delete this step, as UFT One will still be able to set the password field without this operation
- Line 4 is Setting the Password as Mercury. **UFT One automatically encrypts passwords** **entered while recording** to avoid security breaches. This value cannot be decrypted i.e. there is no way to recover the original value using this cryptic data. You can explicitly encrypt a password using the Password Encoder Tool. For our learning purposes, we will use the password in its raw form. And the operation will also change to Set
- Line 5 is clicking the okay button
- Line 6 is closing the window

⚠️ **Version note:** the recorded path above points at the old *C:\\Program Files\\HP\\samples\\flight* location used by HP QTP. The sample Flight Reservation application still ships with UFT One, but under the current installation folder, so the literal path in a script recorded today will differ.

Click [here](https://www.guru99.com/faq#faq1) if the video is not accessible

## SystemUtil.Run Syntax and Arguments

The recorded line above uses only the first argument, but the method accepts five. Knowing all of them turns SystemUtil.Run from a recorder artefact into a deliberate launch step you can write by hand.

```
SystemUtil.Run file, [params], [dir], [op], [mode]
```

| **Argument** | **Required?** | **What it does** |
| --- | --- | --- |
| **file** | Required | Name of the file or application to run. A non-executable file opens in its associated application. |
| **params** | Optional | Parameters passed to the application when *file* is an executable. Default is an empty string. |
| **dir** | Optional | Default directory for the application or file. Default is an empty string. |
| **op** | Optional | Action to perform: open, edit, explore, find or print. A blank value performs open. |
| **mode** | Optional | Integer that controls how the window is displayed when it opens. Default is 1. |

The **op** argument is the one most testers never discover. It maps onto the same verbs Windows Explorer offers on a right-click.

| **op value** | **Result** |
| --- | --- |
| open | Opens the file, folder or executable named in *file*. |
| edit | Launches an editor and opens the document for editing. Fails if the file is not an editable document. |
| explore | Explores the folder named in *file*. |
| find | Starts a search from the specified folder path. |
| print | Prints the document named in *file*. Fails if the file is not printable. |

For **mode**, the values that matter day to day are 0 (hide the window and activate another), 1 (activate and display at its original size), 2 (activate minimized) and 3 (activate maximized). Higher values control focus and restore behaviour and are rarely needed in a test.

**Don't Miss:**

- [What is QTP/UFT Automation Testing Tool?](https://www.guru99.com/uft-qtp-automation-testing.html)
- [Reporter.ReportEvent in UFT/QTP with Example](https://www.guru99.com/uft-qtp-reporter-reportevent.html)
- [Actions in QTP/UFT with Example](https://www.guru99.com/uft-qtp-actions.html)
- [Descriptive Programming in QTP/UFT: Dynamic & Static](https://www.guru99.com/uft-qtp-descriptive-programming.html)

## SystemUtil.Run Examples: Applications, Browsers and Files

The examples below build up one argument at a time, so you can see what each position adds. Paste them into a new action and run them one line at a time.

**1) file only** — the shortest useful form. An executable on the system path needs no folder, and a document opens in whatever application Windows has registered for it.

```
SystemUtil.Run "notepad.exe"
SystemUtil.Run "C:\Data\Orders.txt"
```

**2) file plus params** — anything the application would accept on a command line goes here. This is how a browser is opened on a specific address rather than its home page.

```
SystemUtil.Run "notepad.exe", "C:\Data\Orders.txt"
```

**3) adding dir** — useful when an application refuses to start unless its own folder is the working directory.

```
SystemUtil.Run "flight.exe", "", "C:\Program Files\HP\samples\flight\app\"
```

**4) adding op** — the same file, four different outcomes.

```
SystemUtil.Run "C:\Data\Orders.txt", "", "", "edit"
SystemUtil.Run "C:\Data", "", "", "explore"
SystemUtil.Run "C:\Data", "", "", "find"
SystemUtil.Run "C:\Data\Orders.txt", "", "", "print"
```

**5) adding mode** — open the window maximized so later steps are not blocked by a partly hidden control.

```
SystemUtil.Run "notepad.exe", "C:\Data\Orders.txt", "", "open", 3
```

Because the launched window becomes an ordinary test object, the very next line can drive it. The official documentation pairs Run with Type and Close in exactly this way.

```
SystemUtil.Run "C:\type.txt", "", "", ""
Window("Text:=type.txt - Notepad").Type "happy days"
Window("Text:=type.txt - Notepad").Close
```

Notice the descriptive *Text:=* form in that snippet: no repository entry is needed. The same idea is covered at length in [descriptive programming](https://www.guru99.com/uft-qtp-descriptive-programming.html), and hard-coded paths like the ones above are usually better held in [environment variables](https://www.guru99.com/environment-variable-in-qtp-hp-uft.html) so one script runs on every machine.

## Set, SetSecure and Type: Which Method to Use

Lines 2 to 4 of the recorded script use three different methods on the same kind of edit field. They are not interchangeable, and picking the wrong one is a common cause of a step that passes silently without entering anything.

| **Method** | **What it sends** | **Use it when** |
| --- | --- | --- |
| **Set** | Writes a plain-text value directly into the field. | Normal data entry, including a password you are happy to keep readable. |
| **SetSecure** | Writes an encoded string that UFT One decodes at run time. | Any password field, so the value never appears in the script or the results. |
| **Type** | Sends raw keystrokes, including keys such as micTab. | Keyboard behaviour is part of the test, or a control only reacts to real keys. |

As the walkthrough notes, the Tab keystroke on line 3 exists only because the recorder captured a human habit. UFT One identifies the password field by its properties, so deleting that line changes nothing. Swap SetSecure for Set and the same login runs with a readable password.

```
Dialog("Login").WinEdit("Password:").Set "mercury"
```

To go the other way and encode a value outside a recording session, use the **Password Encoder**. The GUI tool ships with UFT One, and the same encoding is available from a command line as *CryptonCMD.exe -e* in the product bin folder. Both produce strings you can drop into a SetSecure argument or into a [data table parameter](https://www.guru99.com/uft-qtp-parameterization.html). The vendor is explicit that this encoding is not a security standard: it hides a value on screen, it does not protect real customer data.

Once these three methods are second nature, the rest of the language follows quickly — the [VBScript basics](https://www.guru99.com/vbscript-tutorials-for-beginners.html) and the wider [UFT One tutorial series](https://www.guru99.com/quick-test-professional-qtp-tutorial.html) cover loops, conditions and reusable functions, while [Object Spy and GetROProperty](https://www.guru99.com/uft-qtp-objectspy-getroproperty.html) show you which properties UFT One is actually matching on.

## FAQs

⚡ When does UFT One add a SystemUtil.Run step automatically?

A Run statement is written into the test automatically whenever you start an application from the Windows Start menu or the Run dialog box during recording. Typing the statement by hand gives the same result.

🔐 Can a SetSecure encoded password be recovered as plain text?

No. The encoded string cannot be turned back into the original password, which is why a lost value has to be re-encoded rather than decrypted. Replace the whole argument if the password changes.

🛠️ How do you encode a password outside a recording session?

Use the Password Encoder tool that ships with UFT One, or run CryptonCMD.exe -e followed by the string from the product bin folder. Both emit a value suitable for a SetSecure argument or a data table cell.

🧭 What other ways can a UFT One test launch an application?

Record and Run Settings can open the application before the first step, and the legacy InvokeApplication statement still works. The vendor keeps InvokeApplication only for backward compatibility and recommends Run instead.

🛑 How do you close applications a run session opened?

Besides Window(…).Close, the SystemUtil object offers CloseProcessByName, CloseProcessById, CloseProcessByHwnd, CloseProcessByWndTitle and CloseDescendentProcesses, which shuts every process the run session started.

🤖 Can AI help write UFT One VBScript launch and login steps?

AI assistants can draft Run, Set and Type statements from a plain-English description and suggest fixes when a locator breaks. Every generated line still needs a review against the real object properties before it runs.

🚀 Does GitHub Copilot support VBScript for UFT One tests?

Copilot completes VBScript in any editor it supports, so a helper function or a loop over test data is quick to scaffold. UFT One has no Copilot plugin, so the code is pasted into the editor and verified there.

🧪 Why might a working Run statement fail on another machine?

The literal path is the usual cause: a different install folder, a 32-bit versus 64-bit Program Files split, or a mapped drive that does not exist. Holding paths in environment variables removes the problem.

#### Summarize this post with:

ChatGPTPerplexityGrokGoogle AI

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.**

##### Sign up for the newsletter

Subscribe for Free

You have successfully subscribed.  
Please check your inbox.

![AI-Newsletter]() Chosen by over **350,000+** professionals

[Scroll to top](#wrapper)

×

Search for:

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/understand-systemutil-run-setsecure-set-type.png","url":"https://www.guru99.com/images/understand-systemutil-run-setsecure-set-type.png","width":"700","height":"250","caption":"Understand SystemUtil.Run, SetSecure, Set, Type","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/uft-qtp-systemutil-run.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/qtp","name":"UFT"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/uft-qtp-systemutil-run.html","name":"Understand SystemUtil.Run, SetSecure, Set, Type: QTP/UFT"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/uft-qtp-systemutil-run.html#webpage","url":"https://www.guru99.com/uft-qtp-systemutil-run.html","name":"Understand SystemUtil.Run, SetSecure, Set, Type: QTP/UFT","dateModified":"2026-10-10T17:08:12+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/understand-systemutil-run-setsecure-set-type.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/uft-qtp-systemutil-run.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/editorial","name":"Editorial Team","url":"https://www.guru99.com/author/editorial","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/favicon-new-logo.png","url":"https://www.guru99.com/images/favicon-new-logo.png","caption":"Editorial Team","inLanguage":"en-US"},"sameAs":["https://www.guru99.com/editorial-team"],"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"UFT","headline":"Understand SystemUtil.Run, SetSecure, Set, Type: QTP/UFT","description":"This tutorial explains how to record script in QTP and learn QTP step by step","keywords":"qtp","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/editorial","name":"Editorial Team"},"dateModified":"2026-10-10T17:08:12+05:30","image":{"@id":"https://www.guru99.com/images/understand-systemutil-run-setsecure-set-type.png"},"copyrightYear":"2026","name":"Understand SystemUtil.Run, SetSecure, Set, Type: QTP/UFT","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"When does UFT One add a SystemUtil.Run step automatically?","acceptedAnswer":{"@type":"Answer","text":"A Run statement is written into the test automatically whenever you start an application from the Windows Start menu or the Run dialog box during recording. Typing the statement by hand gives the same result."}},{"@type":"Question","name":"Can a SetSecure encoded password be recovered as plain text?","acceptedAnswer":{"@type":"Answer","text":"No. The encoded string cannot be turned back into the original password, which is why a lost value has to be re-encoded rather than decrypted. Replace the whole argument if the password changes."}},{"@type":"Question","name":"How do you encode a password outside a recording session?","acceptedAnswer":{"@type":"Answer","text":"Use the Password Encoder tool that ships with UFT One, or run CryptonCMD.exe -e followed by the string from the product bin folder. Both emit a value suitable for a SetSecure argument or a data table cell."}},{"@type":"Question","name":"What other ways can a UFT One test launch an application?","acceptedAnswer":{"@type":"Answer","text":"Record and Run Settings can open the application before the first step, and the legacy InvokeApplication statement still works. The vendor keeps InvokeApplication only for backward compatibility and recommends Run instead."}},{"@type":"Question","name":"How do you close applications a run session opened?","acceptedAnswer":{"@type":"Answer","text":"Besides Window(...).Close, the SystemUtil object offers CloseProcessByName, CloseProcessById, CloseProcessByHwnd, CloseProcessByWndTitle and CloseDescendentProcesses, which shuts every process the run session started."}},{"@type":"Question","name":"Can AI help write UFT One VBScript launch and login steps?","acceptedAnswer":{"@type":"Answer","text":"AI assistants can draft Run, Set and Type statements from a plain-English description and suggest fixes when a locator breaks. Every generated line still needs a review against the real object properties before it runs."}},{"@type":"Question","name":"Does GitHub Copilot support VBScript for UFT One tests?","acceptedAnswer":{"@type":"Answer","text":"Copilot completes VBScript in any editor it supports, so a helper function or a loop over test data is quick to scaffold. UFT One has no Copilot plugin, so the code is pasted into the editor and verified there."}},{"@type":"Question","name":"Why might a working Run statement fail on another machine?","acceptedAnswer":{"@type":"Answer","text":"The literal path is the usual cause: a different install folder, a 32-bit versus 64-bit Program Files split, or a mapped drive that does not exist. Holding paths in environment variables removes the problem."}}]}],"@id":"https://www.guru99.com/uft-qtp-systemutil-run.html#schema-595763","isPartOf":{"@id":"https://www.guru99.com/uft-qtp-systemutil-run.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/uft-qtp-systemutil-run.html#webpage"}},{"@type":"VideoObject","embedUrl":"https://www.youtube.com/embed/0LT9DGtT360","name":"Understand SystemUtil.Run, SetSecure, Set, Type: QTP/UFT","description":"This tutorial explains how to record script in QTP and learn QTP step by step","uploadDate":"2020-01-09T00:00:00+05:30","thumbnailUrl":"https://i.ytimg.com/vi/0LT9DGtT360/maxresdefault.jpg","hasPart":[],"width":"560","height":"315","@id":"https://www.guru99.com/uft-qtp-systemutil-run.html#schema-595765","isPartOf":{"@id":"https://www.guru99.com/uft-qtp-systemutil-run.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"}]}
```
