Using Run PowerScript function

Table 3. 

Syntax

Supported

Run(string {, windowstate})

The value of a string argument can be a filename without a path or extension. The following examples are supported:

run("notepad")

run("notepad.exe")

run("C:\winnt\system32\notepad")

run("C:\winnt\system32\notepad.exe")

Application programs location

Supported

When you call the Run function and do not specify the path of the application program to the string argument, make sure that the application program is stored in one of the following directories. If it is not, an execution error will occur. The directory is searched in the following order:

  1. Windows system directory: The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is SYSTEM32.

  2. The Windows directory

    Use the GetWindowsDirectory function to get the path of this directory.

  3. The directories that are listed in the PATH environment variable.

    When you make changes to the environment variables, the environment variables take effect only after you restart the machine.