Converting VBScript's Left Function
Definition: Returns a specified number of characters from the left side of a string.
What’s that? You want to know if it’s possible to use Windows PowerShell to return the first x characters in a string? Of course it is: all you have to do is call the Substring method, passing two parameters: the starting character (with 0 being the first character position) and the number of characters to return. For example, this command assigns the letters of the alphabet to a variable named $a, then uses Substring to reassign $a just the first three letters in the string:
$a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$a = $a.substring(0,3)
When you run this command and then echo back the value of $a you should get the following:
ABC