Our vBulletin migration is complete.
Welcome vBulletin users! All content and user information from the Micro Focus Forums (vBulletin) site has been migrated to this site. READ MORE.

Within Silk Test Classic how can I verify if a cmd window from a specific directory exists is running

Within Silk Test Classic how can I verify if a cmd window from a specific directory exists is running

It is possible to retrieve a process running on a machine with the use of the SYS_Execute() method in Silk Test Classic.  The following scripts demonstrates how to search for all cmd.exe processes running on a machine.  If a command window exists the path to the executable is compared to a value.  If a match is found true is returned if no match is found false is returned.

testcase FindCMDWin()
     List of string lsCMD
     String sCMD
     String sWin
     Boolean bCMDFound
     String sWinToFind="C:\windows\system32\cmd.exe"
      //get list of cmd processes currently running
      SYS_Execute("wmic process where name=""cmd.exe"" get executablepath",lsCMD)
     //remove header from returned list
      ListDelete (lsCMD, 1)
      if ListCount(lsCMD) > 0
          //search for cmd window
          for each sWin in lsCMD
                //look for window if not an empty string
               if sWin != ""

                  //if window found return true
                  if matchStr(sWinToFind+"*",sWin)
                        bCMDFound = True
                  else
                        bCMDFound = False
                else
                      bCMDFound = False

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2017-09-29 15:54
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.