Is it possible to reset the runspace in Powershell ISE?

耗尽温柔 提交于 2019-11-29 10:58:41

问题


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?


回答1:


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.




回答2:


(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



来源:https://stackoverflow.com/questions/7338395/is-it-possible-to-reset-the-runspace-in-powershell-ise

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!