有关详细信息、列表和自动变量的说明,请参阅about_Automatic_Variables。 首选项变量:首选项变量存储 PowerShell 的用户首选项。 这些变量由 PowerShell 创建,并使用默认值填充。 用户可以更改这些变量的值。 例如,$MaximumHistoryCount变量确定会话历史记录中的最大条目数。
Length Property int Length {get;} 有关PowerShell 中的变量的详细信息,请参阅about_Variables。 使用环境提供程序和项 cmdlet PowerShell的环境提供程序提供了一个接口,用于以类似于文件系统驱动器的格式与环境变量交互。 它允许你在 PowerShell 中获取、添加、更改、清除和删除环境变量和值。 例如,创建Foo值为 ...
可以通过定义远程命令的参数并使用 cmdlet 的Invoke-CommandArgumentList参数将局部变量指定为参数值,在远程命令中使用局部变量。 param使用关键字 (keyword) 定义远程命令的参数。 参数名称是不需要与局部变量名称匹配的占位符。 在 命令中使用param由 关键字 (keyword) 定义的参数。 使用cmdlet 的Invoke-CommandArgumentLi...
可以在 PowerShell 中使用 .NET 类的静态属性。 静态属性是类的属性,与标准属性不同,标准属性是对象的属性。 若要获取类的静态属性,请使用 cmdlet 的Get-MemberStatic参数。 例如,以下命令获取 类的System.DateTime静态属性。 PowerShell Get-Date|Get-Member-MemberTypeProperty-Static ...
Fix WildcardPattern.Escape to escape lone backticks correctly (#25211) (Thanks @ArmaanMcleod!) Convert -ChildPath parameter to string[] for Join-Path cmdlet (#24677) (Thanks @ArmaanMcleod!) PowerShell 7.6-preview.4 includes the following updated modules: Microsoft.PowerShell.ThreadJob v2.2.0...
示例2:获取已安装的模块和可用模块 PowerShell Get-Module-ListAvailable 此命令获取计算机上安装的模块,并且可以导入到当前会话中。 Get-Module查找由$Env:PSModulePath环境变量指定的路径中的可用模块。 有关PSModulePath的详细信息,请参阅about_Modules和about_Environment_Variables。
Common verbs used in Windows PowerShell include: Add, Clear, Copy, Get, Join, Lock, Move, New, Remove, Rename, Select, Set, Split, and Unlock. You can tell what each is used for just from its name. In this article I'll create three cmdlets: one to set the data contents of the ...
Common verbs used in Windows PowerShell include: Add, Clear, Copy, Get, Join, Lock, Move, New, Remove, Rename, Select, Set, Split, and Unlock. You can tell what each is used for just from its name. In this article I'll create three cmdlets: one to set the data contents of the ...
包含路径名词的 cmdlet(即路径cmdlet)使用路径并以所有 PowerShell 提供程序都可以解释的简洁格式返回名称。 它们旨在用于要以特定格式显示路径的所有或部分的程序和脚本。 使用它们,就像使用Dirname、Normpath、Realpath、Join或其他路径处理器一样。 Test-Path旨在处理任何提供程序公开的数据。 若要列出会话中可用的提供...
Fix WildcardPattern.Escape to escape lone backticks correctly (#25211) (Thanks @ArmaanMcleod!) Convert -ChildPath parameter to string[] for Join-Path cmdlet (#24677) (Thanks @ArmaanMcleod!) PowerShell 7.6-preview.4 includes the following updated modules: Microsoft.PowerShell.ThreadJob v2.2.0...