PoshCode Logo PowerShell Code Repository

[CTP3] Invoke-ISE (modification of post by view diff)
View followups from Bernd Kriszio | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/774"></script>download | new post

A little starter for ISE using advanced functions

  1. Set-Alias ISE Invoke-ISE  
  2. function Invoke-ISE ()
  3. <#
  4. .SYNOPSIS
  5.     start ISE from the PS-commandline
  6. .DESCRIPTION
  7.     start ISE provide files as parameters or per pipe-line
  8. .NOTES
  9.     Author : Bernd Kriszio - http://pauerschell.blogspot.com/
  10.     Requires   : PowerShell V2 CTP3
  11.     and please can someone fix the problem that get-help doesn't use this comment
  12. .EXAMPLE  
  13.     Invoke-ISE $foo.ps1
  14. .EXAMPLE  
  15.     Invoke-ISE foo.ps1 foobar.ps1
  16. .EXAMPLE  
  17.     Invoke-ISE 'foo.ps1' 'foobar.ps1'
  18. .EXAMPLE  
  19.     get-childitem f*.ps1 | Invoke-ISE
  20. .EXAMPLE  
  21.     Invoke-ISE (dir f*.ps1)
  22. .EXAMPLE  
  23.     'foo.ps1' | Invoke-ISE
  24. .EXAMPLE  
  25.     Invoke-ISE
  26. .LINKS
  27.     http://tfl09.blogspot.com/2009/01/parameter-attributes-in-powershell-v2.html
  28.     http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2008/12/30/windows-powershell-integrated-scripting-environment-ise.aspx
  29. #>
  30.        
  31. {
  32.     param (    
  33.         [Parameter(Position = 0,
  34.                     Mandatory=$false,
  35.                     ValueFromPipeline=$True,
  36.                     ValueFromRemainingArguments = $true)]
  37.         [string[]]$file    
  38.     )    
  39.     begin {
  40.         $path="$pshome\powershell_ise.exe"
  41.         if ($file -eq $null){
  42.             & $path
  43.         }
  44.     }  
  45.     PROCESS {
  46.             foreach($f in $file){
  47.                 # note the comment of Mark Schill
  48.                 # & $path (resolve-path $f)
  49.                 # http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2008/12/30/windows-powershell-integrated-scripting-environment-ise.aspx#comments
  50.                 & $path ( ([system.IO.FileInfo]$f).FullName)    
  51.             }    
  52.     }
  53. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me