Using Run PowerScript function

Table 4. 

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

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

      or

    • Windows NT/2000: The 16-bit Windows system directory. There is no Win32 function that retrieves the path of this directory, but it is searched. The name of this directory is SYSTEM.

  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.