Is it possible to reset the runspace in Powershell ISE?
One of the features of PowerGUI is the ability to reset the Powershell Runspace as demonstrated in this article and this article.开发者_运维百科 Is it possible to do this in PowerShell ISE?
(I am using PowerShell V3 ISE on the Win8 Release Preview) You can use File>New PowerShell tab to create a new PowerShell runspace inside the ISE
I wrote a module called "ISE Session Tools" to do this a few months back. Essentially the runspace in ISE is equated to a "Tab" container, of which its child documents share the runspace. My script looks at the current open files, remembers them, creates a new Tab (runspace) and closes the old one, then adds the files you had open to the new Tab. Other features:
- AutoSaving of current session (files open in current tab.)
This can be disabled and manually controlled if desired.
- Prompt to reload last session on ISE open
A hint is shown to you reminding you of some of the files you had open. Press <enter>
to accept the default of “Yes, reload my last session.”
- Restarting of the current tab
Essentially cleaning memory and keeping your files open in the editor. You get prompted for this action. Press <enter>
to accept default of “Yes, restart this tab.”
All commands available under “Add-ons” menu for the mouse-fixated. These commands are also bound to hot-keys.
See: http://nivot.org/post/2011/02/14/MakingWindowsPowerShellISEGoodEnough
EDIT: For the time being, the blog's download link for the ISE Session Tools is broken. The Internet Archive still has a copy.
精彩评论