差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン両方とも次のリビジョン | ||
windows:powershell [2019/08/19 06:57] – ともやん | windows:powershell [2020/06/09 07:32] – [変数] ともやん | ||
---|---|---|---|
行 2: | 行 2: | ||
< | < | ||
#result pre { | #result pre { | ||
- | height: 200px; | ||
overflow: scroll; | overflow: scroll; | ||
overflow-x: hidden; | overflow-x: hidden; | ||
+ | font-size: 10px; | ||
+ | } | ||
+ | # | ||
+ | height: 300px; | ||
+ | overflow: scroll; | ||
+ | overflow-x: hidden; | ||
+ | font-size: 10px; | ||
} | } | ||
</ | </ | ||
</ | </ | ||
- | ====== PowerShell ====== | + | ====== PowerShell(Windows) |
+ | [[linux: | ||
+ | \\ | ||
本家: [[https:// | 本家: [[https:// | ||
ソースコード: | ソースコード: | ||
+ | <php> | ||
+ | function curlGet($url) { | ||
+ | $curl = curl_init(); | ||
+ | | ||
+ | curl_setopt($curl, | ||
+ | curl_setopt($curl, | ||
+ | curl_setopt($curl, | ||
+ | curl_setopt($curl, | ||
+ | | ||
+ | $response = curl_exec($curl); | ||
+ | curl_close($curl); | ||
+ | | ||
+ | return $response; | ||
+ | } | ||
+ | |||
+ | $res = curlGet(' | ||
+ | $tags = json_decode($res, | ||
+ | //$lines = explode(" | ||
+ | // | ||
+ | echo ' | ||
+ | </ | ||
\\ | \\ | ||
- | {{:windows:powershell.png?600|PowerShell}}\\ | + | {{:windows:powershell_v7.0.0-rc.2.png?470|PowerShell}}\\ |
**PowerShell** (パワーシェル)は、マイクロソフトが開発した拡張可能なコマンドラインインターフェース (CLI) シェルおよびスクリプト言語である。オブジェクト指向に基づいて設計されており、.NET Frameworkと.NET Coreを基盤としている。\\ | **PowerShell** (パワーシェル)は、マイクロソフトが開発した拡張可能なコマンドラインインターフェース (CLI) シェルおよびスクリプト言語である。オブジェクト指向に基づいて設計されており、.NET Frameworkと.NET Coreを基盤としている。\\ | ||
\\ | \\ | ||
行 19: | 行 48: | ||
Windows 7 以降のオペレーティングシステム (OS) には標準で搭載されている。\\ | Windows 7 以降のオペレーティングシステム (OS) には標準で搭載されている。\\ | ||
\\ | \\ | ||
+ | |||
+ | ===== インストール ===== | ||
+ | [[windows: | ||
+ | <code powershell> | ||
+ | PS > scoop bucket add dorado https:// | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | Checking repo... ok | ||
+ | The dorado bucket was added successfully. | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **Powershell** のインストール\\ | ||
+ | <code powershell> | ||
+ | PS > scoop install powershell | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | Installing ' | ||
+ | PowerShell-6.2.4-win-x64.zip (55.3 MB) [======================================================================] 100% | ||
+ | Checking hash of PowerShell-6.2.4-win-x64.zip ... ok. | ||
+ | Extracting PowerShell-6.2.4-win-x64.zip ... done. | ||
+ | Linking ~\scoop\apps\powershell\current => ~\scoop\apps\powershell\6.2.4 | ||
+ | Creating shim for ' | ||
+ | Creating shortcut for PowerShell Core (pwsh.exe) | ||
+ | ' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **Powershell** のグローバルインストール\\ | ||
+ | <code powershell> | ||
+ | PS > sudo scoop install -g powershell | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | Installing ' | ||
+ | PowerShell-7.0.0-win-x64.zip (88.7 MB) [======================================================================] 100% | ||
+ | Checking hash of PowerShell-7.0.0-win-x64.zip ... ok. | ||
+ | Extracting PowerShell-7.0.0-win-x64.zip ... done. | ||
+ | Linking C: | ||
+ | Creating shim for ' | ||
+ | Creating shortcut for PowerShell (pwsh.exe) | ||
+ | ' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **Powershell(Preview版)** のインストール\\ | ||
+ | <code powershell> | ||
+ | PS > scoop install powershell-preview | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | Installing ' | ||
+ | PowerShell-7.0.0-rc.3-win-x64.zip (88.8 MB) [=================================================================] 100% | ||
+ | Checking hash of PowerShell-7.0.0-rc.3-win-x64.zip ... ok. | ||
+ | Extracting PowerShell-7.0.0-rc.3-win-x64.zip ... done. | ||
+ | Linking ~\scoop\apps\powershell-preview\current => ~\scoop\apps\powershell-preview\7.0.0-rc.3 | ||
+ | Creating shim for ' | ||
+ | WARN Overwriting shim to pwsh.exe installed from powershell | ||
+ | Creating shortcut for PowerShell Preview (pwsh.exe) | ||
+ | ' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== ダウンロード ===== | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | |||
+ | ===== PowerShellGet ===== | ||
+ | PowerShellGet をインストールするには、以下のコマンドを実行する。\\ | ||
+ | < | ||
+ | $ sudo Install-Module -Name PowerShellGet -Force | ||
+ | </ | ||
+ | PowerShellGet を新しいバージョンに更新するには、以下のコマンドを実行する。\\ | ||
+ | < | ||
+ | $ sudo Update-Module -Name PowerShellGet | ||
+ | </ | ||
+ | |||
+ | **参考文献**\\ | ||
+ | [[https:// | ||
+ | |||
+ | ===== 変数 ===== | ||
+ | [[.: | ||
+ | |||
+ | ===== コマンド ===== | ||
+ | [[.: | ||
+ | [[.: | ||
+ | [[.: | ||
===== PowerShell のバージョン ===== | ===== PowerShell のバージョン ===== | ||
行 25: | 行 148: | ||
Name : ConsoleHost | Name : ConsoleHost | ||
- | Version | + | Version |
- | InstanceId | + | InstanceId |
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface | UI : System.Management.Automation.Internal.Host.InternalHostUserInterface | ||
CurrentCulture | CurrentCulture | ||
行 34: | 行 157: | ||
IsRunspacePushed : False | IsRunspacePushed : False | ||
Runspace | Runspace | ||
+ | |||
+ | PS > Get-Host | Select-Object Version | ||
+ | |||
+ | Version | ||
+ | ------- | ||
+ | 6.2.4 | ||
PS > $PSVersiontable | PS > $PSVersiontable | ||
行 39: | 行 168: | ||
Name Value | Name Value | ||
---- ----- | ---- ----- | ||
- | PSVersion | + | PSVersion |
- | PSEdition | + | PSEdition |
- | PSCompatibleVersions | + | GitCommitId |
- | BuildVersion | + | OS |
- | CLRVersion | + | Platform |
- | WSManStackVersion | + | PSCompatibleVersions |
PSRemotingProtocolVersion | PSRemotingProtocolVersion | ||
SerializationVersion | SerializationVersion | ||
+ | WSManStackVersion | ||
+ | |||
</ | </ | ||
行 52: | 行 183: | ||
<code powershell> | <code powershell> | ||
PS > start-process notepad c: | PS > start-process notepad c: | ||
+ | </ | ||
+ | |||
+ | ===== カレントディレクトリ変更 ===== | ||
+ | <code powershell> | ||
+ | PS C: | ||
+ | PS C: | ||
+ | |||
+ | Path | ||
+ | ---- | ||
+ | C: | ||
</ | </ | ||
行 63: | 行 204: | ||
[[http:// | [[http:// | ||
[[https:// | [[https:// | ||
+ | \\ | ||
+ | [[https:// | ||
+ | \\ | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||