Today I had a discussion with my colleague and he mentioned that the only reason why he still uses PowerGUI is that ISE doesn’t support adding of inputs. So we made a deal – if he will not find it on the internet anywhere, I’ll create it. After few minutes he arrived and asked me to do that :)

Whole solution consists of two functions:

Add-ISEScriptParameter: It asks you (using Read-Host) for parameters to your script. I had a version with MessageBox but then leave the final one without it.

Start-ISEScriptWithParameter: This one will run the actual script with parameter stored in previous step.

I use simple hash table for storing pair <FileName>=<Parameter> in Global scope. You can have different values for different scripts.

function Add-ISEScriptParameter
 # Enter parameter(s) you want to use as default
 $paramText = Read-Host &amp;quot;Enter parameter(s) for $($psISE.CurrentFile.DisplayName)&amp;quot;

 # Create hash if not exists
 if (-not $Global:ISEScriptParamHash) { $Global:ISEScriptParamHash = @{} }

 # Add new parameters to the hash
 $Global:ISEScriptParamHash[$psISE.CurrentFile.FullPath] = $paramText

function Start-ISEScriptWithParameter
 # Find name of actual file name
 $File = $psISE.CurrentFile.FullPath

 # Run actual file with stored parameters
 Invoke-Expression -Command &amp;quot;$File $($Global:ISEScriptParamHash[$File])&amp;quot;

$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Add param', {Add-ISEScriptParameter}, 'Ctrl+Shift+F5')
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Run with param', {Start-ISEScriptWithParameter}, 'Ctrl+F5')

You can see I have three scripts opened. Now I want to add params for one of them. So I switch to it and run Ctrl+Shift+F5. ISE promt me for the value of cmdline and stores it to the hash mentioned.

When I want to run the script with these parameters, I can do that with Ctrl+F5.

To see actual value of hash I can pipe it to Format-Table.

PS&amp;gt; $Global:ISEScriptParamHash | ft -AutoSize

Name Value
---- -----
C:\Scripts\matous.ps1 -test 'David'
C:\Scripts\Untitled4.ps1 -test 'untitled'
C:\Scripts\anothertest.ps1 -n1 'prvni' -n2 'druhy v another'

As usual: there are some points to make it nicer, but this was just quick hit. Another guy converted to ISE :)