---
sourceDocument: Brazil Workflow Data Fabric
sourceDocumentLink: https://www.servicenow.com/docs/r/integrate-applications

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil Workflow Data Fabric

ft:clusterId :

    - crint

bundleId :

    - crint

workflow :

    - Creator


---

# Use the CloseMainWindow component

# Use the CloseMainWindow component {#ariaid-title1}

Release version: Brazil  
Updated September 10, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read  
Closes any Windows application by providing the Process ID as input.

## Before you begin

Role required: none

## About this task

You can configure the properties for the CloseMainWindow component. For more information about these properties, see [Properties of the System Process components](https://www.servicenow.com/docs/36_MIo0ZHxwuoRDlH3MvNQ "Learn about the properties of the System Process components in RPA Desktop Design Studio.").

## Procedure

1. In the Toolbox pane, navigate to UtilitiesSystem Process.
2. Drag the CloseMainWindow component to the Design surface.
3. To configure the input field, see [Configure port properties](https://www.servicenow.com/docs/ED3jBpqtlHH8p~yFFmyRBQ "Configure how data is passed to the input fields of a component or method in RPA Desktop Design Studio.").
4. Connect the data and control ports of the CloseMainWindow to the corresponding ports of the other component as described in the following table.  
   {#use-sysprocess-closemainwind__table_jnw_jn1_krb__entry__4}

   | Parameter | Description | Port type | Mandatory? |
   |-|-|-|-|
   | ProcessId | The process ID of the application to close. You can pass this value from a previously executed component. You can get the ProcessId by opening the Task Manager on your Windows machine. Example: :   ProcessId of Services.exe: 660 | Data In | Yes |
   [ ]

   {#use-sysprocess-closemainwind__table_jnw_jn1_krb}
5. **Optional:** To test the component, under the DESIGN tab, click Run.
{#use-sysprocess-closemainwind__steps_mfj_tkp_fgc}

## Example

As part of your automation workflow, after you have opened an app, such as Windows Terminal and ran a command on it, you can close the app window by providing the process ID in the CloseMainWindow component.

Add the Start App component and GetWindowProcessID component before the
CloseMainWindow component and connect the ports as shown in the image.

For more information about these components, see [Use the Start App component](https://www.servicenow.com/docs/NaSeHTJ7ixPDchlzjo3K9g "Start or launch an application or file by using the START APP component in RPA Desktop Design Studio.") and [Use the GetWindowProcessID component](https://www.servicenow.com/docs/g2rSf_Am7rdZdkd4k3Q1tA "Retrieve the window handle of a main window of an active process as an integer by using the GetWindowProcessID component in RPA Desktop Design Studio.").

*[\>]: and then


