Using Windows Programs

You can run Windows command-line programs and start Windows graphic programs in Windows PowerShell. If the program generates text output, you can capture the text and use it in the new shell, just as you would in any shell.

To run a program, such as Notepad, in Windows PowerShell, the executable file for the program must be located in a directory that is included in the Path environment variable, because the value of the Path environment variable determines where Windows PowerShell looks for applications, utilities, and scripts. (Cmdlets do not have to be in a Path directory.)

To see the paths in the Path environment variable, type:

```PS> \$env:path
```

To add directories to the Path environment variable, type:

```PS> \$env:path += ";newdirectory"
```

For example, to add the directory of the WordPad.exe file to the Path variable, type:

```PS> \$env:path += ";C:\Program Files\Windows NT\Accessories"
```

Like the set command, this assignment statement only changes the value of Path for the current Windows PowerShell session. To make the change permanent, add the assignment statement to your Windows PowerShell profile. For details, see the "Windows PowerShell Profiles" topic.

﻿