Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I am running farmanager with FarNet and PowerShellFar I can bring up a console of sorts by selecting F11 | .NET PowerShell | Editor Console. This console is based on the far editor. I can paste snippets of powershell scripts into this console and edit them.

The only problem is if I want to use a multi-line function or control flow segment in the console. If I paste it in it has no effect. If I attempt to type one in I get an error similar to:

ERROR: IncompleteParseException:
Missing closing '}' in statement block.
At line:1 char:42
+ foreach ($number in 1..10 ) { $number * 7 <<<<
    + CategoryInfo          : ParserError: (CloseBraceToken:TokenId) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingEndCurlyBrace

Is this simply a limitation of PowerShellFar?

share|improve this question
    
PowerShellFar 5.0.51 supports multiline commands in editor consoles, see my updated answer. – Roman Kuzmin Dec 14 '13 at 8:56
up vote 1 down vote accepted

This is simply a limitation of the editor console feature of PSF. The editor console is designed for true one-liner commands in the first place.

Multiline commands are not suitable for console-like UI anyway: even if you can input and run such a command then you cannot easily bring it back to modify and run again.

But you still can copy/paste/invoke a snippet. Copy, paste, then select its text in the editor console and do: F11 | PowerShellFar | Invoke selected code. It's a little bit awkward but it works.


UPDATE

PowerShellFar 5.0.51 supports multiline commands in editor consoles:

  • Like in ISE, ShiftEnter just adds a new line without invoking the command.
  • Enter at any position of the last command area invokes the whole area code.
  • As a result, it is possible to paste multiline code and invoke it by Enter.
share|improve this answer
    
Thanks for updating. – Justin Dearing Dec 15 '13 at 16:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .