MO
Size: a a a
MO
MO
4
UE
4
MO
4
4
4
MO
UE
UE
MO
PS > $x = 'x'
PS > $times = '100000000000000'
PS > $times = [long] $times
# var $times now Int64.
PS > $x*$times #want to repeat $x (string) $times.
#Actual error: Question: What the hell powershell tries to type cast to Int32 datatype #type? It should be int64 right? Because $times datatype long (int64)
InvalidArgument: Cannot convert value "100000000000000" to type "System.Int32".
Error: "Value was either too large or too small for an Int32."
PS > $times.GetType().name
Int64
4
Measure-Command -Expression { $a= '';1..100000 | % { $a +="x"}}
TotalSeconds : 11.4645341
4
4
4
4
"x"*2000000000
Exception of type 'System.OutOfMemoryException' was thrown.
4
RV