#navi(../)
* powershell.exeが存在するディレクトリを取得する・$PSHOME [#xcf50c04]
PowerShellプログラムであるpowershell.exeが存在するフォルダを取得する方法を以下に記します。
#contents
#htmlinsert(win_ads_top.html)
* 関連記事 [#o496160e]
-[[PowerShellのバージョンを確認する方法・$PSVersionTable>PowerShell/PowerShellのバージョンを確認する方法・$PSVersionTable]]
* $PSHOME シェル変数 [#w5c83b25]
$PSHOMEを表示することによりpowershell.exeが存在するディレクトリを取得することができます。
PS > $PSHOME
* $PSHOMEを表示してみる [#qe31aaae]
操作はPowerShellを起動し$PSHOMEを入力しEnterキーを押すだけです。~
以下はPowerShellを起動し実際に$PSHOMEを入力しEnterキーを押した時の出力です。~
シェル変数$PSHOMEを表示し、$PSHOMEの場所をdirしています。
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\sakura> $PSHOME
C:\Windows\System32\WindowsPowerShell\v1.0
PS C:\Users\sakura> dir $PSHOME
ディレクトリ: C:\Windows\System32\WindowsPowerShell\v1.0
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2009/07/14 19:49 en-US
d---- 2009/07/14 14:32 Examples
d---- 2009/07/14 19:49 ja-JP
d---- 2009/07/14 14:32 Modules
-a--- 2009/06/11 5:41 27338 Certificate.format.ps1xml
-a--- 2009/07/14 10:29 126976 CompiledComposition.Microsoft.PowerShell.GPowerShell.dll
-a--- 2009/06/11 5:41 27106 Diagnostics.Format.ps1xml
-a--- 2009/06/11 5:41 72654 DotNetTypes.format.ps1xml
-a--- 2009/06/11 5:41 24857 FileSystem.format.ps1xml
-a--- 2009/06/11 5:42 15603 getevent.types.ps1xml
-a--- 2009/06/11 5:41 257847 Help.format.ps1xml
-a--- 2009/07/14 10:39 473600 powershell.exe
-a--- 2009/06/11 5:41 89703 PowerShellCore.format.ps1xml
-a--- 2009/06/11 5:41 18612 PowerShellTrace.format.ps1xml
-a--- 2009/07/14 10:51 200704 powershell_ise.exe
-a--- 2009/07/14 10:29 20480 PSEvents.dll
-a--- 2010/11/20 22:44 174592 pspluginwkr.dll
-a--- 2009/07/14 10:29 2048 pwrshmsg.dll
-a--- 2009/07/14 10:41 28672 pwrshsip.dll
-a--- 2009/06/11 5:41 20120 Registry.format.ps1xml
-a--- 2009/06/11 5:42 168372 types.ps1xml
-a--- 2009/06/11 5:41 24498 WSMan.Format.ps1xml
以上、powershell.exeが存在するディレクトリを表示する方法でした。
//#htmlinsert(win_ads_btm.html)