The method of launching PowerShell scripts from Far Manager I have described previously has 2 important drawbacks:
- You can’t pass arguments to the script, and
- You can’t launch script in a separate window
Here’s how to fix this:
- Start regedit, open HKCR\Microsoft.PowerShellScript.1\shell\Open\command key
- Set it to
"C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe" "-file" "%1" %*
Now you can press Shift+Enter to start PowerShell script in a new window.
As a bonus, you can now double-click .ps1 files in Windows Explorer to launch them. Why is this not a default behaviour? Most likely Microsoft decided to be extra cautious here.
Make sure you have Powershell version 2.0 or higher for this to work. How to check Powershell version.
3 thoughts on “Enhancement to launching PowerShell scripts from Far Manager”
Thanks a lot for very useful tips!
But why comments are off for most of your posts?
For example, at http://chuchuva.com/pavel/2008/03/how-i-configure-far-manager/
I have a comment to the paragraph 9 but can’t leave it there!
That’s because I was afraid of spam and set my blog to disable comments after 1 month, sorry. I have re-enabled comments for that post.
It looks like you are a fun of Far Manager and you also use PowerShell. You may want to take a look at the plugin FarNet and its module PowerShellFar. They allow to run PS scripts in the same session hosted inside and provide Far Manager automation and a lot of tools, related to Far and even not.