Reduce the need for line continuation use in PowerShell commands that span multiple lines
Votes from Connect: 20
Original Date Submitted: 5/10/2013 10:10:12 PM
Description:
Contact Information
Handle: Kirk Munro
Site Name: PowerShell
Feedback ID: 786717
Frequency: Always Happens
Regression: Yes, this happens in all previous versions
Problem Description:
It is well known that the line continuation implementation is challenging (the fact that it doesn't work if there is anything after it, even just whitespace, causes problems for beginners; also, it doesn't help that it simply looks like a spec of dirt on the screen). Yet some of us find that commands are more readable when they span multiple lines, like this:
Do-Something `
-Param value1 `
-Param value2
Also, some of us use line continuance so that we can start a stage in a pipeline with the pipe symbol, like this:
Do-Something `
| Do-SomethingWithIt `
| Do-SomethingElse
Both of these syntaxes make for easy identification of commands that span multiple lines in structured documents.
With these syntaxes being desirable, and with the strong dislike for the backtick line continuance, why not just support these syntaxes without the line continuance character requirement? It would make scripts like this even easier to write, and if you could have comment lines in the middle (please do) it would allow for more detailed comments where desired. Plus, with support for comments in the middle you could play around with pipelines and parameters more easily by commenting/uncommenting various stages by simply commenting or uncommenting lines.
Product Studio item created by Connect Synchronizer due to creation of feedback ID 786717 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=786717).
Repro Steps:
Get-Command
-Verb Get
-Module Microsoft.PowerShell.Management
Get-Service wuauserv
| Where-Object Status -eq Stopped
| Start-Service -Whatif
Expected Results:
Both of these should work as is without requiring line continuance characters. Line continuance characters should be reserved for abnormal line breaks in scripts.
Internal BugId: 4209
