支持所有版本。
Powershell能夠使用.net靜態方法,比如下面有一些你常用的方法:
代碼如下:
[Math]::Round(7.9)
[Convert]::ToString(576255753217, 8)
[Guid]::NewGuid()
[Net.Dns]::GetHostByName('schulung12')
[IO.Path]::GetExtension('c:/test.txt')
[IO.Path]::ChangeExtension('c:/test.txt', 'bak')
要獲得更多的方法,你可以刪掉方括號后面的代碼,再添加兩個冒號,這時在Powershell_ISE中將會彈出這個類所有可選的方法及屬性。在Powershell控制臺中,你也可以使用TAB來獲取選擇方法屬性。
當然你也可以通過管道符查看他所有類型:
代碼如下:
PS> [Math] | Get-Member -MemberType *Method -Static
TypeName: System.Math
Name MemberType Definition
---- ---------- ----------
Abs Method static sbyte Abs(sbyte value), static int16 Abs(int16 value), static int Abs(int value), sta...
Acos Method static double Acos(double d)
Asin Method static double Asin(double d)
Atan Method static double Atan(double d)
Atan2 Method static double Atan2(double y, double x)
BigMul Method static long BigMul(int a, int b)
新聞熱點
疑難解答