2010年8月24日 星期二

PowerShell Learning Note (1) - Data Type



  • Declare : start with '$', 不分大小寫
    • example : $a=3, $b="4", 
    • [int]$value=39 ==> assign type to [int]
  • Data Type

  • [adsi]
    AD 服務物件
    [array]
    陣列
    [bool]
    布林值 (True 或 False)
    [byte]
    8 位元無號整數
    [char]
    單一個 Unicode 字元(16位元)
    [datetime]
    日期或時間
    [decimal]
    128 位元十進位值
    [double]
    倍精度 64 位元浮點數
    [hashtable]
    雜湊表物件
    [int] 或 [int32]
    32 位元有號整數
    [long]
    64 位元有號整數
    [regex]
    規則運算式
    [single]
    單精度 32 位元浮點數
    [scriptblock]
    程式區塊
    [string]
    固定長度的 Unicode 字串
    [WMI]
    WMI 執行個體或集合
    [WMIclass]
    WMI 類別
    [xml]
    Xml 物件
  • $var | get-Member ==> Variable is an object, This can use to get different type's variable's attribute and member function to know how to handle it
    • $str="a string"
      $len=$str.Length


沒有留言: