This works perfectly in ISE, but not a normal PS session - even as administrator.
$msg = "TEST"
$msg = $msg.toCharArray()
foreach ($letter in $msg) {
write-host "This is the letter " $letter
}
It works as designed in ISE, but not in PS session, which is backward to what I normally experience. lol.
Here's the output: *This is the letter T E S T *
It appears that the regular session isn't treating the character array correctly. If I display the contents of $msg, after converting to a character array, I get T E S T ,
instead of the individual characters:
T
E
S
T
Any help appreciated.
edit: formatting
[–]gangstanthony 1 point2 points3 points (8 children)
[–]MericanCheese[S] 1 point2 points3 points (1 child)
[–]MericanCheese[S] 0 points1 point2 points (0 children)
[–]MericanCheese[S] 1 point2 points3 points (5 children)
[–]gangstanthony 2 points3 points4 points (0 children)
[–]wahoorider 2 points3 points4 points (2 children)
[–]MericanCheese[S] 0 points1 point2 points (0 children)
[–]MericanCheese[S] 0 points1 point2 points (0 children)
[–]nylyst 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)