Export (0) Print
Expand All
Expand Minimize
2 out of 3 rated this helpful - Rate this topic

Converting VBScript's String Function


Windows PowerShell


Definition: Returns a repeating character string of the length specified.

String

The String function provides a quick, reasonably fail-safe way to create a string consisting of a specified number of repeating characters. In other words, a string similar to this:


"===================="

(Yeah, we know. But this is sometimes useful when formatting data for display in a command window.)

If you ever do need to string together 20 equal signs or what-have-you in Windows PowerShell, you can accomplish this task by multiplying (yes, we said multiplying) an equals sign by 20 (strange, but true):


$a = "=" * 20

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


====================


Return to the VBScript to Windows PowerShell home page

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.