IBM Support

How to close, minimize or maximize a Command Prompt window?

Troubleshooting


Problem

A Robot GUI script is recorded which closes a Command Prompt window (cmd.exe) using the button marked with an [x] in the title bar of the window. During playback, the window is not closed, and the log eventually reports no script failure. The same thing happens with the Minimize and Maximize buttons.

Resolving The Problem

The user actions recorded against any of the buttons in the title bar of a Command Prompt window: Minimize, Maximize, Close are not recorded by Rational Robot under Windows XP and Windows 2000.

The solution is to manually insert into the script the code that will represent the action.

Robot will for instance record:

Sub Main


Dim Result As Integer

StartApplication "cmd"

Window SetContext, "Caption=C:\WINNT\system32\cmd.exe", ""

' Here is missing a line of code
End Sub

To complete the script, insert one of the following lines where it is missing.

To Minimize the window:
Window WMinimize, "Caption=C:\WINNT\System32\CMD.EXE", ""

To Maximize the window:
Window WMaximize, "Caption=C:\WINNT\System32\CMD.EXE", ""

To Close the window:
Window CloseWin, "Caption=C:\WINNT\System32\CMD.EXE", ""



[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"General information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2003;2003.06.00;2003.06.12","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

134003346

Document Information

Modified date:
16 June 2018

UID

swg21129984