• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >PowerShell > Powershell中可以使用的.Net实用静态方法

Powershell中可以使用的.Net实用静态方法

作者:junjie 字体:[增加 减小] 来源:互联网

junjie 通过本文主要向大家介绍了powershell安装 net,powershell,windows powershell,powershell是什么,powershell下载等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

支持所有版本。

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')
</div>

要获得更多的方法,你可以删掉方括号后面的代码,再添加两个冒号,这时在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)  
Ceiling         Method     static decimal Ceiling(decimal d), static double Ceiling(double a)
Cos             Method     static double Cos(double d)
Cosh            Method     static double Cosh(double value                                                            
DivRem          Method     static int DivRem(int a, int b, [ref] int result), static long DivRem(long a, long b, [ref] ...
Equals          Method     static bool Equals(System.Object objA, System.Object objB)
Exp             Method     static double Exp(double d)             
Floor           Method     static decimal Floor(decimal d), static double Floor(double d)
IEEERemainder   Method     static double IEEERemainder(double x, double y)
Log             Method     static double Log(double d), static double Log(double a, double newBase)
Log10           Method     static double Log10(double d)
Max             Method     static sbyte Max(sbyte val1, sbyte val2), static byte Max(byte val1, byte val2), static int1...
Min             Method     static sbyte Min(sbyte val1, sbyte val2), static byte Min(byte val1, byte val2), static int1...
Pow             Method     static double Pow(double x, double y)
ReferenceEquals Method     static bool ReferenceEquals(System.Object objA, System.Object objB)
Round           Method     static double Round(double a), static double Round(double value, int digits), static double ...
Sign            Method     static int Sign(sbyte value), static int Sign(int16 value), static int Sign(int value), stat...
Sin             Method     static double Sin(double a)
Sinh            Method     static double Sinh(double value)  
Sqrt            Method     static double Sqrt(double d)
Tan             Method     static double Tan(double a)
Tanh            Method     static double Tanh(double value)
Truncate        Method     static decimal Truncate(decimal d), static double Truncate(double d)
</div>

要查看方法的参数,省略掉他的括号即可:

PS> Get-Something -Path test
You entered test.

PS> [Math]::Round

OverloadDefinitions               &nbs

您可能想查找下面的文章:

  • Powershell中可以使用的.Net实用静态方法
  • Powershell小技巧之查看安装的.Net framework版本信息
  • PowerShell中调用.NET对象的静态方法、静态属性和类方法、类属性例子

相关文章

  • PowerShell小技巧之观察UNC路径
  • Windows Powershell 定义变量
  • Powershell小技巧之屏蔽输出结果
  • Powershell使用OpenFileDialog打开文件示例
  • Powershell小技巧之等待输入一个按键
  • 自定义PowerShell控制台提示符风格的方法
  • 简单谈谈PowerShell 4.0中的新命令
  • Powershell使用WINDOWS事件日志记录程序日志
  • PowerShell实现在控制台中插入绿色的打勾符号
  • PowerShell 4.0实现自动化设置服务器

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • Powershell实现按类型排序
    • Windows Powershell调用静态方法
    • PowerShell入门教程之创建和使用配置文件实例
    • PowerShell: Try...Catch...Finally 实现方法
    • PowerShell中Get-Date对象的常用属性和方法介绍
    • PowerShell定义函数参数的2种方法和传参方法实例
    • Powershell使用嵌套哈希表实例 嵌套哈希表的2种写法例子
    • PowerShell脚本开发之批量扫描IP和端口
    • PowerShell中查看当前版本、Windows版本、.NET版本信息的代码
    • PowerShell时间记录脚本

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有