PoshCode Logo PowerShell Code Repository

[CTP3] Invoke-ISE (modification of post by Bernd Kriszio view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/775"></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. .EXAMPLE  
  12.     Invoke-ISE $foo.ps1
  13. .EXAMPLE  
  14.     Invoke-ISE foo.ps1 foobar.ps1
  15. .EXAMPLE  
  16.     Invoke-ISE 'foo.ps1' 'foobar.ps1'
  17. .EXAMPLE  
  18.     get-childitem f*.ps1 | Invoke-ISE
  19. .EXAMPLE  
  20.     Invoke-ISE (dir f*.ps1)
  21. .EXAMPLE  
  22.     'foo.ps1' | Invoke-ISE
  23. .EXAMPLE  
  24.     Invoke-ISE
  25. .LINK
  26.     http://tfl09.blogspot.com/2009/01/parameter-attributes-in-powershell-v2.html
  27.     http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2008/12/30/windows-powershell-integrated-scripting-environment-ise.aspx
  28. #>
  29.        
  30. {
  31.     param (    
  32.         [Parameter(Position = 0,
  33.                     Mandatory=$false,
  34.                     ValueFromPipeline=$True,
  35.                     ValueFromRemainingArguments = $true)]
  36.         [string[]]$file    
  37.     )    
  38.     begin {
  39.         $path="$pshome\powershell_ise.exe"
  40.         if ($file -eq $null){
  41.             & $path
  42.         }
  43.     }  
  44.     PROCESS {
  45.             foreach($f in $file){
  46.                 # note the comment of Mark Schill
  47.                 # & $path (resolve-path $f)
  48.                 # http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2008/12/30/windows-powershell-integrated-scripting-environment-ise.aspx#comments
  49.                 & $path ( ([system.IO.FileInfo]$f).FullName)    
  50.             }    
  51.     }
  52. }

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