差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン両方とも次のリビジョン | ||
windows:powershell [2020/02/15 07:37] – [ダウンロード] ともやん | windows:powershell [2020/09/11 20:07] – ともやん | ||
---|---|---|---|
行 1: | 行 1: | ||
- | < | + | ~~CLOSETOC~~ |
- | < | + | ====== PowerShell(Windows) |
- | #result pre { | + | [[linux: |
- | height: 200px; | + | \\ |
- | overflow: scroll; | + | |
- | overflow-x: hidden; | + | |
- | } | + | |
- | </ | + | |
- | </ | + | |
- | ====== PowerShell ====== | + | |
本家: [[https:// | 本家: [[https:// | ||
ソースコード: | ソースコード: | ||
- | \\ | + | < |
- | {{:windows:powershell_v6.2.4.png?600|PowerShell}}\\ | + | 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; | ||
+ | } | ||
+ | |||
+ | //$url = ' | ||
+ | $url = ' | ||
+ | //$res = curlGet($url); | ||
+ | //$tags = json_decode($res, | ||
+ | //$lines = explode(" | ||
+ | |||
+ | /* | ||
+ | $dom = new DOMDocument; | ||
+ | @$dom-> | ||
+ | $xpath = new DOMXPath($dom); | ||
+ | $xpath = $xpath-> | ||
+ | var_dump($xpath); | ||
+ | $html = array_map( | ||
+ | function ($node) use ($xpath) { | ||
+ | return [' | ||
+ | }); | ||
+ | var_dump($html); | ||
+ | */ | ||
+ | echo ' | ||
+ | </ | ||
+ | |||
+ | {{windows:powershell_v7.0.0-rc.2.png?470|PowerShell}}\\ | ||
**PowerShell** (パワーシェル)は、マイクロソフトが開発した拡張可能なコマンドラインインターフェース (CLI) シェルおよびスクリプト言語である。オブジェクト指向に基づいて設計されており、.NET Frameworkと.NET Coreを基盤としている。\\ | **PowerShell** (パワーシェル)は、マイクロソフトが開発した拡張可能なコマンドラインインターフェース (CLI) シェルおよびスクリプト言語である。オブジェクト指向に基づいて設計されており、.NET Frameworkと.NET Coreを基盤としている。\\ | ||
- | \\ | + | |
かつては Microsoft Shell (MSH、コードネーム Monad) と呼ばれていた。\\ | かつては Microsoft Shell (MSH、コードネーム Monad) と呼ばれていた。\\ | ||
- | \\ | + | |
Windows 7 以降のオペレーティングシステム (OS) には標準で搭載されている。\\ | Windows 7 以降のオペレーティングシステム (OS) には標準で搭載されている。\\ | ||
- | \\ | + | |
+ | ===== インストール ===== | ||
+ | [[windows: | ||
+ | <code powershell> | ||
+ | PS > scoop bucket add dorado https:// | ||
+ | </ | ||
+ | <WRAP prewrap 100% # | ||
+ | < | ||
+ | Checking repo... ok | ||
+ | The dorado bucket was added successfully. | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **Powershell** のインストール\\ | ||
+ | <code powershell> | ||
+ | PS > scoop install powershell | ||
+ | </ | ||
+ | <WRAP prewrap 100% # | ||
+ | < | ||
+ | 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% # | ||
+ | < | ||
+ | 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% # | ||
+ | < | ||
+ | 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) | ||
+ | ' | ||
+ | </ | ||
+ | </ | ||
===== ダウンロード ===== | ===== ダウンロード ===== | ||
行 24: | 行 116: | ||
[[https:// | [[https:// | ||
[[https:// | [[https:// | ||
+ | [[https:// | ||
[[https:// | [[https:// | ||
[[https:// | [[https:// | ||
+ | [[https:// | ||
+ | |||
+ | ===== PowerShellGet ===== | ||
+ | [[https:// | ||
+ | PowerShell ギャラリー | ||
+ | |||
+ | PowerShellGet をインストールするには、以下のコマンドを実行する。\\ | ||
+ | < | ||
+ | $ sudo Install-Module -Name PowerShellGet -Force | ||
+ | </ | ||
+ | PowerShellGet を新しいバージョンに更新するには、以下のコマンドを実行する。\\ | ||
+ | < | ||
+ | $ sudo Update-Module -Name PowerShellGet | ||
+ | </ | ||
+ | |||
+ | **参考文献**\\ | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | |||
+ | ===== Powershell のテーマ設定 ===== | ||
+ | 現在のコンソール設定をバックアップする。\\ | ||
+ | < | ||
+ | $ concfg export console-backup.json | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | console settings exported to console-backup.json | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ソラリゼーションカラーテーマを使用する。\\ | ||
+ | < | ||
+ | $ concfg import solarized-dark | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | Console settings were imported from ' | ||
+ | Overrides in the registry and shortcut files might interfere with your concfg settings. Would you like to find and remove them? (Y/n): y <- 入力する | ||
+ | Removing ' | ||
+ | Removing ' | ||
+ | Reset console properties of shortcut ' | ||
+ | Reset console properties of shortcut ' | ||
+ | |||
+ | Would you like to open a new console to see the changes? (Y/n): n <- 入力する | ||
+ | </ | ||
+ | |||
+ | 上記の翻訳\\ | ||
+ | < | ||
+ | Overrides in the registry and shortcut files might interfere with your concfg settings. Would you like to find and remove them? | ||
+ | </ | ||
+ | < | ||
+ | レジストリファイルおよびショートカットファイルのオーバーライドは、concfg設定に干渉する可能性があります。それらを見つけて削除しますか? | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Would you like to open a new console to see the changes? | ||
+ | </ | ||
+ | < | ||
+ | 変更を確認するために新しいコンソールを開きますか? | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== 参考文献 ==== | ||
+ | [[https:// | ||
+ | |||
+ | ===== 変数 ===== | ||
+ | [[.: | ||
+ | |||
+ | ===== コマンド ===== | ||
+ | [[.: | ||
+ | [[.: | ||
+ | [[.: | ||
+ | [[.: | ||
===== PowerShell のバージョン ===== | ===== PowerShell のバージョン ===== | ||
行 67: | 行 233: | ||
<code powershell> | <code powershell> | ||
PS > start-process notepad c: | PS > start-process notepad c: | ||
+ | </ | ||
+ | |||
+ | ===== カレントディレクトリ変更 ===== | ||
+ | <code powershell> | ||
+ | PS C: | ||
+ | PS C: | ||
+ | |||
+ | Path | ||
+ | ---- | ||
+ | C: | ||
</ | </ | ||
行 78: | 行 254: | ||
[[http:// | [[http:// | ||
[[https:// | [[https:// | ||
+ | \\ | ||
+ | [[https:// | ||
+ | \\ | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||