0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Powershell基本集

Posted at

#Powershell基本

##PSCustomObject(Powershell V3.0以降)

test.ps1

$Object = [PSCustomObject]@{

  Name = "BOB"
  Aget = 17
  Sex = "Male"

}


##ハッシュ更新

test.ps1

#以下の2項目の配列があると想定(name属性をキーとする)
#$User.name
#$User.Value

#キーが存在した場合
If($HashTable.ContainsKeys($user.name)){

 #今回チェックしたものが登録されているものより大きいか確認
  If($HashTable[$user.name].Value -lt $user.Value ){

    #登録済みキーの値を更新
    $Hashtable[$user.name] = $user.value

  }

#キーが存在しなかった場合
}else{

  #キーを値と合わせて追加
  $Hashtable.Add($user.name,$user.value )

}




0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?