Converting VBScript's UCase Function

Definition: Returns a string that has been converted to uppercase.

UCase

Sometimes bigger truly is better, which is one reason you might want to convert all the characters in a string to their uppercase equivalent. How do you pull off such a feat in Windows PowerShell? That’s easy: you just call the ToUpper() method. For example, these two commands assign the letters of the alphabet to the variable $a, then use the ToUpper() method to convert each of those letters to uppercase:

$a = "abcdefghijklmnopqrstuvwxyz"
$a = $a.ToUpper()

When you run this command and then echo back the value of $a you should get the following:

ABCDEFGHIJKLMNOPQRSTUVWXYZ

Return to the VBScript to Windows PowerShell home page