November 20, 2012

How to create a new Snippet in PowerShell ISE 3

Paste this code in a PowerShell ISE new tab :

[scriptblock]$code = 
{#PutYourCodeHere
}

New-IseSnippet `
    -Text $code.ToString() `
    -CaretOffset $code.ToString().Length `
    -Force `
    -Title ‘SnippetTitle’ `
    -Description ‘SnippetDescription’ 

Replace the #PutYourCodeHere by your Powershell commands, set the snippet Title, description and run it. Why not make a snippet to create snippet.

References :

No comments:

Post a Comment