13 May 2010

Calling PowerShell from Launchy

I have recently started using Launchy, a Windows keyword launcher. One problem I had with Launchy was configuring it to call my assorted PowerShell scripts.  An initial search of the web led me to this blog post, which in turn led me here.  So… call my PowerShell scripts from a batch file that I call from Launchy?  No, I don’t think so.
So, I searched again, and came across this screencast by PowerShell guru Hal Rottenberg, who showed how to configure Launchy to run your scripts. 

In Launchy, select the options, and in the Plugins tab, select the Runner (a custom command tool) options.  To create a new command, click on the ‘+’ button. Set the new command’s name  as “posh”, and then set the program by double clicking the field.  A folder browse button will appear.  Browse to the PowerShell directory (%windir%\system32\WindowsPowerShell\v1.0) and clicking on the program executable, powershell.exe.  You then need to type in the command arguments as follows:
"-nologo -noexit -noprofile -command $$"
To run your scripts from Launchy, hit the Launchy keyboard shortcut (ALT + SPACE by default), and type “posh”. Then hit the tab key, and type in the name of the script that you wish to run.  In this way, you can call your PowerShell scripts.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.