Scripting Games 2012 Comments: #1 Line Continuation

As with previous games I’ll publish a series of comments on the games. I won’t deal with any event specific issues until the games events are all closed but there are some things coming through that while not affecting any gradings don’t make the best use of PowerShell.

The first one that’s jumped out is line continuation.

I’ve seen a number of examples like the following two

get-service | `
sort status  -Descending

or

get-service  `
| sort status  -Descending

Both work but the line continuation character is unnecessary

All you need to do is

get-service |
sort status  -Descending

The pipeline symbol also works as a line continuation.

A minor point maybe but let PowerShell do the work for you

Published Sun, Apr 8 2012 14:55 by RichardSiddaway

Comments

# 2012 Scripting Games blog roll

2012 Scripting Games blog roll

Tuesday, April 10, 2012 6:16 PM by Ed Wilson Blog

# 2012 Scripting Games blog roll

Summary: The Scripting Wife reveals the blogs she has been reading to stay current for the 2012 Scripting

Tuesday, April 10, 2012 6:17 PM by Hey, Scripting Guy! Blog

# 2012 Scripting Games blog roll

Summary: The Scripting Wife reveals the blogs she has been reading to stay current for the 2012 Scripting

Tuesday, April 10, 2012 7:09 PM by Hey, Scripting Guy! Blog

# re: Scripting Games 2012 Comments: #1 Line Continuation

Excellent, I actually made this mistake in my scripts, thanks for the update!

Wednesday, April 11, 2012 1:30 AM by Jaap Brasser

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: