両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン |
windows:powershell:commands:get-command [2020/08/30 19:22] – ともやん | windows:powershell:commands:get-command [2022/06/04 04:11] (現在) – ともやん |
---|
<html> | |
<style> | |
#result pre, #mincode pre { | |
overflow: hidden; | |
font-size: 10px; | |
} | |
#result_long pre, #mincode_long pre { | |
height: 250px; | |
overflow: scroll; | |
overflow-x: hidden; | |
font-size: 10px; | |
} | |
#mintbl table { | |
font-size: 12px; | |
} | |
.dokuwiki .plugin_wrap table { | |
width: auto; | |
} | |
#logo { | |
background-color: white; | |
padding: 10px; | |
width: fit-content; | |
} | |
#logo p { | |
margin: 0; | |
} | |
</style> | |
</html> | |
====== Get-Command (alias: gcm) ====== | ====== Get-Command (alias: gcm) ====== |
現在のセッションで使用できるコマンドを取得する。\\ | 現在のセッションで使用できるコマンドを取得する。\\ |
</WRAP> | </WRAP> |
| |
Windows のコマンドプロンプトでは、**where** コマンドが使える。\\ | Windows のコマンドプロンプトでは、もともと **where** コマンドが使える🤔\\ |
<WRAP prewrap 100%> | <WRAP prewrap 100%> |
<code batch> | <code batch> |
</WRAP> | </WRAP> |
| |
Windows の PowerShell では、**where** コマンドは Alias の関係で使えない。\\ | しかし、Windows の PowerShell では、**where** コマンドは Alias の関係で使えない😅\\ |
<WRAP prewrap 100%> | <WRAP prewrap 100%> |
<code powershell> | <code powershell> |
</WRAP> | </WRAP> |
| |
Windows の PowerShell では、**where.exe** とすると使える。\\ | Windows の PowerShell では、**where.exe** とすると使える🙄\\ |
<WRAP prewrap 100%> | <WRAP prewrap 100%> |
<code powershell> | <code powershell> |
</WRAP> | </WRAP> |
| |
Windows の where コマンドは、以下に存在している。\\ | Windows の **where** コマンドは、以下に存在している🤯\\ |
<WRAP prewrap 100%> | <WRAP prewrap 100%> |
<code powershell> | <code powershell> |
$ gcm where.exe | $ gcm where.exe |
| </code> |
</WRAP> | </WRAP> |
<WRAP prewrap 100% #result> | <WRAP prewrap 100% #result> |
CommandType Name Version Source | CommandType Name Version Source |
----------- ---- ------- ------ | ----------- ---- ------- ------ |
Application where.exe 10.0.2020… C:\WINDOWS\system32\where.exe</code> | Application where.exe 10.0.2020… C:\WINDOWS\system32\where.exe |
</code> | </code> |
</WRAP> | </WRAP> |
| |
| Windows の PowerShell で **where** コマンドは容量だけ食って使い物にならなくなった😒ので、**where.exe** の別名として **which** を登録しておくと良い😁\\ |
| <WRAP prewrap 100%> |
| <code powershell> |
| $ echo "sal which where.exe" >> $profile |
| $ . $profile |
| $ which python |
| </code> |
| </WRAP> |
| <WRAP prewrap 100% #result> |
| <code powershell> |
| C:\Users\tomoyan\scoop\apps\python\current\python.exe |
| C:\Users\tomoyan\scoop\shims\python.exe |
| C:\Users\tomoyan\AppData\Local\Microsoft\WindowsApps\python.exe |
| </code> |
| </WRAP> |
| |
| もしくは、[[windows:scoop|Scoop]] の [[windows:gow|Gow]] または [[windows:busybox|BusyBox]] をインストールすると **which** コマンドが使えるようになる😍\\ |
| [[windows:gow|Gow (Gnu On Windows) - Linux コマンド群 (Cygwin 軽量版)]]\\ |
| [[windows:busybox|BusyBox - UNIXコマンド詰め合わせセット🤤]]\\ |
| |
===== Windows 10 ===== | ===== Windows 10 ===== |
PowerShell の Cmdlet などを調べる。\\ | PowerShell の Cmdlet, Function, Alias などを調べる。\\ |
<code powershell> | <code powershell> |
PS > Get-Command | $ gcm Get-Command |
| </code> |
| <WRAP prewrap 100% #result> |
| <code powershell> |
| |
| CommandType Name Version Source |
| ----------- ---- ------- ------ |
| Cmdlet Get-Command 7.0.3.0 Microsoft.PowerShell.Core |
| |
| </code> |
| </WRAP> |
| |
| PowerShell モジュール内のコマンドを一覧する。\\ |
| <code powershell> |
| $ gcm -Module Microsoft.PowerShell.Management |
| </code> |
| <WRAP prewrap 100% #result_long> |
| <code powershell> |
| |
| CommandType Name Version Source |
| ----------- ---- ------- ------ |
| Cmdlet Add-Content 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Clear-Content 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Clear-Item 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Clear-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Clear-RecycleBin 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Convert-Path 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Copy-Item 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Copy-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Debug-Process 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-ChildItem 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-Clipboard 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-ComputerInfo 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-Content 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-HotFix 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-Item 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-ItemPropertyValue 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-Location 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-Process 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-PSDrive 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-PSProvider 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-Service 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Get-TimeZone 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Invoke-Item 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Join-Path 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Move-Item 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Move-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet New-Item 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet New-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet New-PSDrive 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet New-Service 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Pop-Location 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Push-Location 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Remove-Item 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Remove-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Remove-PSDrive 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Remove-Service 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Rename-Computer 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Rename-Item 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Rename-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Resolve-Path 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Restart-Computer 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Restart-Service 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Resume-Service 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Set-Clipboard 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Set-Content 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Set-Item 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Set-ItemProperty 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Set-Location 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Set-Service 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Set-TimeZone 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Split-Path 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Start-Process 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Start-Service 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Stop-Computer 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Stop-Process 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Stop-Service 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Suspend-Service 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Test-Connection 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Test-Path 7.0.0.0 Microsoft.PowerShell.Management |
| Cmdlet Wait-Process 7.0.0.0 Microsoft.PowerShell.Management |
| |
| </code> |
| </WRAP> |
| |
| <code powershell> |
| $ gcm |
</code> | </code> |
<WRAP prewrap 100% #result_long> | <WRAP prewrap 100% #result_long> |
</code> | </code> |
</WRAP> | </WRAP> |
| |
| ===== 参考文献 ===== |
| [[https://docs.microsoft.com/ja-jp/powershell/module/microsoft.powershell.core/get-command|Get-Command (Microsoft.PowerShell.Core) - PowerShell | Microsoft Docs]]\\ |
| |