Type Conversion


VBScript provides a number of specific functions to convert between data types including CStr(), CInt(), and CDate(). PowerShell uses a single operator, -as, to do the same thing:

 $var = $var2 -as [string] 

This example attempt to convert $var2 into a string and store the result in $var. Refer to Chapter 5 for more information on variables and types, and Appendix B for a more detailed list of the major types used in PowerShell.



Windows PowerShell. TFM
Internet Forensics
ISBN: 982131445
EAN: 2147483647
Year: 2004
Pages: 289

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net