#navi(../)
* 実行しているPowerShellの変数一覧を表示する・Get-Variable [#tcce66f6]
実行しているPowerShellに設定されている変数一覧を表示する方法を以下に記します。

#contents
#htmlinsertpcsp(win-top.html,win-sp.html)

* Get-Variable引数なしで現在実行中のPowerShellに設定されている変数を表示する [#b124d26b]
Get-Variableコマンドレットを引数なしで実行することにより、シェル変数と設定した変数の一覧を表示することができます。~
以下にGet-Variableを実行したときの出力を記します。

 Windows PowerShell
 Copyright (C) 2009 Microsoft Corporation. All rights reserved.
 
 PS C:\Users\sakura> Get-Variable
 
 Name                           Value
 ----                           -----
 $
 ?                              True
 ^
 _
 args                           {}
 ConfirmPreference              High
 ConsoleFileName
 DebugPreference                SilentlyContinue
 Error                          {}
 ErrorActionPreference          Continue
 ErrorView                      NormalView
 ExecutionContext               System.Management.Automation.EngineIntrinsics
 false                          False
 FormatEnumerationLimit         4
 HOME                           C:\Users\sakura
 Host                           System.Management.Automation.Internal.Host.InternalHost
 input                          System.Collections.ArrayList+ArrayListEnumeratorSimple
 MaximumAliasCount              4096
 MaximumDriveCount              4096
 MaximumErrorCount              256
 MaximumFunctionCount           4096
 MaximumHistoryCount            64
 MaximumVariableCount           4096
 MyInvocation                   System.Management.Automation.InvocationInfo
 NestedPromptLevel              0
 null
 OutputEncoding                 System.Text.ASCIIEncoding
 PID                            1652
 PROFILE                        C:\Users\sakura\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
 ProgressPreference             Continue
 PSBoundParameters              {}
 PSCulture                      ja-JP
 PSEmailServer
 PSHOME                         C:\Windows\System32\WindowsPowerShell\v1.0
 PSSessionApplicationName       wsman
 PSSessionConfigurationName     http://schemas.microsoft.com/powershell/Microsoft.PowerShell
 PSSessionOption                System.Management.Automation.Remoting.PSSessionOption
 PSUICulture                    ja-JP
 PSVersionTable                 {CLRVersion, BuildVersion, PSVersion, WSManStackVersion...}
 PWD                            C:\Users\sakura
 ReportErrorShowExceptionClass  0
 ReportErrorShowInnerException  0
 ReportErrorShowSource          1
 ReportErrorShowStackTrace      0
 ShellId                        Microsoft.PowerShell
 StackTrace
 true                           True
 VerbosePreference              SilentlyContinue
 WarningPreference              Continue
 WhatIfPreference               False
 
 
 PS C:\Users\sakura>

以上、Get-Variableコマンドレットを使用してシェル変数とユーザが定義した変数を表示する方法でした。

#htmlinsertpcsp(win-btm.html,win-sp.html)

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS