powershell - Adding element to hashtable failed -
ps c:\users\hind> $b=@{} ps c:\users\hind> $b+={k="a";v="b"} hash table can added hash table. @ line:1 char:1 + $b+={k="a";v="b"} + ~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (:) [], runtimeexception + fullyqualifiederrorid : addhashtabletononhashtable
why did fail? how can add 1 element hashtable successfully?
correction, fails because missing @
character in front of @{k="a";b="b"}
ps c:\users\hind> $b=@{} ps c:\users\hind> $b+=@{k="a";v="b"}
@{}
declaring new hash table. {}
script block. not same.
Comments
Post a Comment