# PowershellUtils package for Sublime Text

This plugin provides an interface to filter buffer text through a Windows Powershell pipeline and run and capture Powershell commands.

## Requirements

Windows Powershell v2

Windows Powershell v2 is preinstalled in Windows 7 and later and it's available for previous versions of Windows too under the name Windows Management Framework.

Powershell is a powerful languange and needs to be used carefully to avoid undesired effects.

## Getting Started

If you're running a full installation, simply double click on the .sublime-package files. If you're running a portable installation, perform an installation by hand.

Lastly, run run_powershell from the Python console or bind this command to a key combination:

# In Sublime's Python console.
view.run_command("run_powershell")

## Using The Windows Powershell Pipeline

1. Execute run_powershell
2. Type in your Windows Powershell command
3. Press enter

All the currently selected regions in Sublime Text will be piped into your command sequencially. In turn, you can access each of this regions through the $_ automatic variable. Roughly, this is what goes on behind the scenes: reg1..regN | <your command> | out-string You can ignore the piped content and treat your command as the start point of the pipeline. The generated output will be inserted into each region in turn. ### Using Intrinsic Commands (Not all intrinsic commands work.) The following commands have a special meaning for this plugin: !mkh Saves the session's history of commands to a file. !h Brings up the history of commands so you can choose one and run it again. ### Examples$_.toupper()
Turns each region's content to all caps.
$_ -replace "\\","/" Replaces each region's content as indicated. "$(date)"
Replaces each region's content with the current date.

## Other Ways of Using PowershellUtils

PowershellUtils can be called with arguments so that the prompt is bypassed. This is interesting if you want to integrate powershell with a separate plugin.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.