## org.openqa.selenium.server.browserlaunchers
Class WindowsUtils

    java.lang.Object
      org.openqa.selenium.server.browserlaunchers.WindowsUtils

    public class WindowsUtils

extends java.lang.Object

Constructor Summary
`WindowsUtils()`

Method Summary
`static void` `deleteRegistryValue(java.lang.String key)`
`static java.lang.Class` `discoverRegistryKeyType(java.lang.String key)`
`static boolean` `doesRegistryValueExist(java.lang.String key)`
`static java.lang.String` `findReg()` Finds reg.exe
`static java.io.File` `findSystemRoot()` Finds the system root directory, e.g.
`static java.lang.String` `findTaskKill()` Finds taskkill.exe
`static java.io.File` `findWBEM()` Finds the WBEM directory in the systemRoot directory
`static java.lang.String` `findWMIC()` Finds WMIC.exe
`static java.lang.String` `getEnvVarIgnoreCase(java.lang.String var)`
`static java.lang.String` `getExactPathEnvKey()` Retrieve the exact case-sensitive name of the "Path" environment variable, which may be any one of "PATH", "Path" or "path".
`static java.lang.String` `getLocalAppDataPath()` Returns the path to Local AppData.
`static java.lang.String` `getPath()`
`static java.lang.String` `getProgramFilesPath()` Returns the path to the Windows Program Files.
`static boolean` `isRegExeVersion1()`
`static void` `kill(java.lang.String[] cmdarray)` Searches the process list for a process with the specified command line and kills it
`static void` `killByName(java.lang.String name)` Kill processes by name
`static java.util.Properties` `loadEnvironment()` Returns the current process environment variables
`static void` `main(java.lang.String[] args)`
`static java.util.Map` `procMap()` Returns a map of process IDs to command lines
`static boolean` `readBooleanRegistryValue(java.lang.String key)`
`static int` `readIntRegistryValue(java.lang.String key)`
`static java.lang.String` `readStringRegistryValue(java.lang.String key)`
`static boolean` `thisIsWindows()` Returns true if the current OS is MS Windows; false otherwise
`static void` `tryToKillByName(java.lang.String name)` Kill processes by name, log and ignore errors
`static void` `writeBooleanRegistryValue(java.lang.String key, boolean data)`
`static void` `writeIntRegistryValue(java.lang.String key, int data)`
`static void` `writeStringRegistryValue(java.lang.String key, java.lang.String data)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WindowsUtils

    public WindowsUtils()

Method Detail

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Parameters:
    `args` -
  Throws:
    `java.io.IOException`
    `java.lang.Exception`

### killByName

    public static void killByName(java.lang.String name)

  Kill processes by name

### tryToKillByName

    public static void tryToKillByName(java.lang.String name)

  Kill processes by name, log and ignore errors

### kill

    public static void kill(java.lang.String[] cmdarray)
                     throws java.lang.Exception

  Searches the process list for a process with the specified command line and kills it

  Parameters:
    `cmdarray` - the array of command line arguments
  Throws:
    `java.lang.Exception` - if something goes wrong while reading the process list or searching for your command line

### procMap

    public static java.util.Map procMap()
                                 throws java.lang.Exception

  Returns a map of process IDs to command lines

  Returns:
    a map of process IDs to command lines
  Throws:
    `java.lang.Exception` - - if something goes wrong while reading the process list

### loadEnvironment

    public static java.util.Properties loadEnvironment()

  Returns the current process environment variables

  Returns:
    the current process environment variables

### getExactPathEnvKey

    public static java.lang.String getExactPathEnvKey()

  Retrieve the exact case-sensitive name of the "Path" environment variable, which may be any one of "PATH", "Path" or "path".

  Returns:
    the exact case-sensitive name of the "Path" environment variable

### getPath

    public static java.lang.String getPath()

### getProgramFilesPath

    public static java.lang.String getProgramFilesPath()

  Returns the path to the Windows Program Files. On non-English versions, this is not necessarily "C:\Program Files".

  Returns:
    the path to the Windows Program Files

### getLocalAppDataPath

    public static java.lang.String getLocalAppDataPath()

  Returns the path to Local AppData. For different users, this will be different.

  Returns:
    the path to Local AppData

### getEnvVarIgnoreCase

    public static java.lang.String getEnvVarIgnoreCase(java.lang.String var)

### findSystemRoot

    public static java.io.File findSystemRoot()

  Finds the system root directory, e.g. "c:\windows" or "c:\winnt"

### findWMIC

    public static java.lang.String findWMIC()

  Finds WMIC.exe

  Returns:
    the exact path to wmic.exe, or just the string "wmic" if it couldn't be found (in which case you can pass that to exec to try to run it from the path)

### findWBEM

    public static java.io.File findWBEM()

  Finds the WBEM directory in the systemRoot directory

  Returns:
    the WBEM directory, or `null` if it couldn't be found

### findTaskKill

    public static java.lang.String findTaskKill()

  Finds taskkill.exe

  Returns:
    the exact path to taskkill.exe, or just the string "taskkill" if it couldn't be found (in which case you can pass that to exec to try to run it from the path)

### findReg

    public static java.lang.String findReg()

  Finds reg.exe

  Returns:
    the exact path to reg.exe, or just the string "reg" if it couldn't be found (in which case you can pass that to exec to try to run it from the path)

### isRegExeVersion1

    public static boolean isRegExeVersion1()

### discoverRegistryKeyType

    public static java.lang.Class discoverRegistryKeyType(java.lang.String key)

### readStringRegistryValue

    public static java.lang.String readStringRegistryValue(java.lang.String key)

### readIntRegistryValue

    public static int readIntRegistryValue(java.lang.String key)

### readBooleanRegistryValue

    public static boolean readBooleanRegistryValue(java.lang.String key)

### doesRegistryValueExist

    public static boolean doesRegistryValueExist(java.lang.String key)

### writeStringRegistryValue

    public static void writeStringRegistryValue(java.lang.String key,
                                                java.lang.String data)
                                         throws org.openqa.selenium.server.browserlaunchers.WindowsUtils.WindowsRegistryException

  Throws:
    `org.openqa.selenium.server.browserlaunchers.WindowsUtils.WindowsRegistryException`

### writeIntRegistryValue

    public static void writeIntRegistryValue(java.lang.String key,
                                             int data)

### writeBooleanRegistryValue

    public static void writeBooleanRegistryValue(java.lang.String key,
                                                 boolean data)

### deleteRegistryValue

    public static void deleteRegistryValue(java.lang.String key)

### thisIsWindows

    public static boolean thisIsWindows()

  Returns true if the current OS is MS Windows; false otherwise

  Returns:
    true if the current OS is MS Windows; false otherwise

Copyright © 2009. All Rights Reserved.