Get-Variable cmdlet 获取当前控制台中的 PowerShell 变量。 可以通过指定 ValueOnly 参数来仅检索变量的值,并且可以按名称筛选返回的变量。
若要取得 PowerShell 工作階段中所有變數的清單,請輸入 Get-Variable。 變數名稱會顯示,而沒有用來參考變數的前一個貨幣符號($) 符號。 例如: PowerShell 複製 $MyVariable = 1, 2, 3 $Path = "C:\Windows\System32" 變數可用於儲存命令的結果。 例如: PowerShell 複製 $Processes = Get-Process $To...
& (Get-Command -Name Map -CommandType Function) or & (dir Function:\map) You can also save your hidden command in a variable to make it easier to run. For example, the following command saves the Map function in the $myMap variable and then uses the Call operator to run it. $myMap...
PowerShellGet 显示另外 5 个 当我开始学习 PowerShell 时,我最初依赖于图形用户界面(GUI),这些任务对于简单 PowerShell 命令来说似乎过于复杂。 但是,当我继续学习时,我改进了我的技能,从基本的单行程序迁移到创建脚本、函数和模块。 请务必记住,在线高级示例让人不知所措的感觉是正常的。 没有人在 PowerShell...
Windows PowerShell will use the String data type to store the value. In .NET Framework terms, that's the System.String class, which has perhaps the most built-in functionality of any variable type. If, say, I want to see an all-lowercase version of the value in $var, I can do this...
Get-WinEvent 参考 反馈 模块: Microsoft.PowerShell.Diagnostics 获取本地和远程计算机上的事件日志和事件跟踪日志文件中的事件。 语法 PowerShell复制 Get-WinEvent[[-LogName] <String[]>] [-MaxEvents <Int64>] [-ComputerName <String>] [-Credential <PSCredential>] [-FilterXPath <String>] [-Force] [...
Get-FileHash Get-FormatData Get-Host Get-MarkdownOption Get-Member Get-PSBreakpoint Get-PSCallStack Get-Random Get-Runspace Get-RunspaceDebug Get-SecureRandom Get-TraceSource Get-TypeData Get-UICulture Get-Unique Get-Uptime Get-Variable Get-Verb Group-Object Import-Alias Import-Clixml Import-Csv...
Get-Process-Id6-ErrorVariablea 以下命令将错误消息添加到$a变量: PowerShell Get-Process-Id2-ErrorVariable+a 以下命令显示$a的内容: PowerShell $a 可以使用此参数创建一个变量,该变量仅包含来自特定命令的错误消息,并且不会影响$Error自动变量的行为。$Error自动变量包含会话中所有命令的错误消息。 可以使用数组...
Get-FileHash Get-FormatData Get-Host Get-MarkdownOption Get-Member Get-PSBreakpoint Get-PSCallStack Get-Random Get-Runspace Get-RunspaceDebug Get-SecureRandom Get-TraceSource Get-TypeData Get-UICulture Get-Unique Get-Uptime Get-Variable Get-Verb Group-Object Import-Alias Import-Clixml Import-Csv...
Alias gu Get-Unique Alias gv Get-Variable Alias gwmi Get-WmiObject Alias h Get-History Alias history Get-History Alias icm Invoke-Command Alias iex Invoke-Expression Alias ihy Invoke-History Alias ii Invoke-Item Alias ipal Import-Alias