Let’s say you use Far Manager and want to launch PowerShell script. With default installation pressing Enter on PowerShell script in Far Manager will open the script in Notepad. Not very helpful.
Here’s how to configure Far Manager to launch PowerShell script by pressing Enter key:
- Open Commands menu, select File associations.
- Press Ins key to add new association.
- Enter *.ps1 as file mask.
- Enter the following as execute command:
powershell.exe -file "!.!"
Bonus: how to change colour of PowerShell scripts to green:
- Open Options menu, select Files highlighting.
- Locate *.exe,*.com,*.bat entry, press Enter to edit.
- Add *.ps1 to the list, select Ok to save.
See also: Running Windows PowerShell Scripts
Update: there is an enhancement that allows passing arguments to the script and launch script in a separate window.