A few months ago I write a blog post about winning a bet about a PowerShell Switch statement.
Jeffery Hicks commented on the post that he was hoping I used PowerShell to write the code in that post… if I had done it by hand I would have been plain crazy!
Now although I am pretty much crazy, I don’t like manual labor… so, how can you do something like that in an easy way?
It’s actually very easy with just three simple steps:
1) Create 300 objects:
1 |
1..300 |
2) For each object, do a Write-Output:
1 |
1..300 | ForEach-Object {Write-Output "$_ {The number is $_}"} |
4) Redirect the output to the clipboard so you can paste it in a blog post:
1 |
1..300 | ForEach-Object {Write-Output "$_ {The number is $_}"} | clip.exe |
Writing the script? about 3 minutes…
Doing it by hand? Are you nuts!!!!???? 😉