差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
| windows:powershell [2020/02/15 10:28] – ともやん | windows:powershell [2023/10/06 14:49] (現在) – [インストール] ともやん | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | < | + | ====== PowerShell(Windows) |
| - | < | + | |
| - | #result pre { | + | |
| - | height: 200px; | + | |
| - | overflow: scroll; | + | |
| - | overflow-x: hidden; | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| - | ====== PowerShell ====== | + | |
| [[linux: | [[linux: | ||
| \\ | \\ | ||
| 行 28: | 行 19: | ||
| } | } | ||
| - | $res = curlGet(' | + | //$url = ' |
| - | $tags = json_decode($res, | + | $url = ' |
| + | //$res = curlGet($url); | ||
| + | //$tags = json_decode($res, | ||
| //$lines = explode(" | //$lines = explode(" | ||
| - | // | + | |
| - | echo ' | + | /* |
| + | $dom = new DOMDocument; | ||
| + | @$dom-> | ||
| + | $xpath = new DOMXPath($dom); | ||
| + | $xpath = $xpath-> | ||
| + | var_dump($xpath); | ||
| + | $html = array_map( | ||
| + | function ($node) use ($xpath) { | ||
| + | return [ | ||
| + | ' | ||
| + | ]; | ||
| + | }, $xpath-> | ||
| + | var_dump($html); | ||
| + | */ | ||
| + | echo ' | ||
| </ | </ | ||
| - | \\ | + | |
| - | {{:windows: | + | {{windows: |
| **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: | ||
| + | |||
| + | dorado バケットを追加する😉\\ | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | PS > <b class=HIY> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | Checking repo... ok | ||
| + | <b class=GRN> | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **PowerShell** のインストール\\ | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | PS > <b class=HIY> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | Installing ' | ||
| + | PowerShell-7.3.6-win-x64.zip (102.9 MB) [=====================================================================] 100% | ||
| + | Checking hash of <b class=CYN> | ||
| + | Extracting <b class=CYN> | ||
| + | Linking ~\scoop\apps\powershell\current => ~\scoop\apps\powershell\7.3.6 | ||
| + | Creating shim for ' | ||
| + | Creating shortcut for PowerShell (pwsh.exe) | ||
| + | <b class=GRN>' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **PowerShell** のグローバルインストール\\ | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | PS > <b class=HIY> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | Installing ' | ||
| + | PowerShell-7.0.0-win-x64.zip (88.7 MB) [======================================================================] 100% | ||
| + | Checking hash of <b class=CYN> | ||
| + | Extracting <b class=CYN> | ||
| + | Linking C: | ||
| + | Creating shim for ' | ||
| + | Creating shortcut for PowerShell (pwsh.exe) | ||
| + | <b class=GRN>' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **PowerShell(Preview版)** のインストール\\ | ||
| + | <WRAP color_term> | ||
| + | <WRAP color_command>< | ||
| + | PS > <b class=HIY> | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| + | Installing ' | ||
| + | PowerShell-7.0.0-rc.3-win-x64.zip (88.8 MB) [=================================================================] 100% | ||
| + | Checking hash of <b class=CYN> | ||
| + | Extracting <b class=CYN> | ||
| + | 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) | ||
| + | <b class=GRN>' | ||
| + | </ | ||
| + | </ | ||
| ===== ダウンロード ===== | ===== ダウンロード ===== | ||
| 行 47: | 行 120: | ||
| [[https:// | [[https:// | ||
| [[https:// | [[https:// | ||
| + | [[https:// | ||
| [[https:// | [[https:// | ||
| [[https:// | [[https:// | ||
| + | [[https:// | ||
| + | |||
| + | ===== 変数 ===== | ||
| + | [[.powershell: | ||
| + | |||
| + | ===== コマンド ===== | ||
| + | [[.powershell: | ||
| + | [[.powershell: | ||
| + | [[.powershell: | ||
| + | [[.powershell: | ||
| + | [[.powershell: | ||
| + | |||
| + | ===== コマンド履歴 ===== | ||
| + | <code powershell> | ||
| + | $ less (Get-PSReadlineOption).HistorySavePath | ||
| + | </ | ||
| + | |||
| + | <code powershell> | ||
| + | $ cat (Get-PSReadlineOption).HistorySavePath | grep "scoop search" | ||
| + | </ | ||
| + | |||
| + | ===== 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 のバージョン ===== | ||
| 行 90: | 行 247: | ||
| <code powershell> | <code powershell> | ||
| PS > start-process notepad c: | PS > start-process notepad c: | ||
| + | </ | ||
| + | |||
| + | ===== カレントディレクトリ変更 ===== | ||
| + | <code powershell> | ||
| + | PS C: | ||
| + | PS C: | ||
| + | |||
| + | Path | ||
| + | ---- | ||
| + | C: | ||
| </ | </ | ||
| 行 100: | 行 267: | ||
| ===== 参考文献 ===== | ===== 参考文献 ===== | ||
| [[http:// | [[http:// | ||
| - | [[https:// | + | [[git>PowerShell/ |
| + | |||
| + | [[https:// | ||
| + | |||
| + | [[https:// | ||
| + | [[https:// | ||
| + | [[https:// | ||
| + | [[https:// | ||
| + | [[https:// | ||
| + | |||
| + | [[https:// | ||
| + | [[https:// | ||
| + | [[git> | ||
| + | [[https:// | ||