(echo 00001) -vs- 00001 -- are they equal?
examine following powershell sequence. how can numeric quantity retain leading zeros?
<# c: #> $n1 = echo 00001 <# c: #> $n2 = 00001 <# c: #> $n1 -eq $n2 true <# c: #> $n1 00001 <# c: #> $n2 1 <# c: #> $n1.gettype() ispublic isserial name basetype -------- -------- ---- -------- true true int32 system.valuetype <# c: #> $n2.gettype() ispublic isserial name basetype -------- -------- ---- -------- true true int32 system.valuetype
examine following powershell sequence. how can numeric quantity retain leading zeros?
<# c: #> $n1 = echo 00001 <# c: #> $n2 = 00001 <# c: #> $n1 -eq $n2 true <# c: #> $n1 00001 <# c: #> $n2 1 <# c: #> $n1.gettype() ispublic isserial name basetype -------- -------- ---- -------- true true int32 system.valuetype <# c: #> $n2.gettype() ispublic isserial name basetype -------- -------- ---- -------- true true int32 system.valuetype
$n1 = echo 00001
the variable $n1 is not a system.int32.
the variable $n1 represents a system.int32.
the variable $n1 is a psvariable, value property of 00001.
it's easy know variable $n1 represents:
•
... don't disturb ... life short, , have think i'll next ...
Windows Server > Windows PowerShell
Comments
Post a Comment