差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン両方とも次のリビジョン | ||
windows:powershell [2020/02/15 10:28] – ともやん | windows:powershell [2020/09/11 19:31] – ともやん | ||
---|---|---|---|
行 1: | 行 1: | ||
- | < | + | ~~CLOSETOC~~ |
- | < | + | ====== PowerShell(Windows) |
- | #result pre { | + | |
- | height: 200px; | + | |
- | overflow: scroll; | + | |
- | overflow-x: hidden; | + | |
- | } | + | |
- | </ | + | |
- | </ | + | |
- | ====== PowerShell ====== | + | |
[[linux: | [[linux: | ||
\\ | \\ | ||
行 32: | 行 24: | ||
//$lines = explode(" | //$lines = explode(" | ||
// | // | ||
- | echo ' | + | echo ' |
</ | </ | ||
\\ | \\ | ||
- | {{: | + | {{: |
**PowerShell** (パワーシェル)は、マイクロソフトが開発した拡張可能なコマンドラインインターフェース (CLI) シェルおよびスクリプト言語である。オブジェクト指向に基づいて設計されており、.NET Frameworkと.NET Coreを基盤としている。\\ | **PowerShell** (パワーシェル)は、マイクロソフトが開発した拡張可能なコマンドラインインターフェース (CLI) シェルおよびスクリプト言語である。オブジェクト指向に基づいて設計されており、.NET Frameworkと.NET Coreを基盤としている。\\ | ||
\\ | \\ | ||
行 42: | 行 34: | ||
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) | ||
+ | ' | ||
+ | </ | ||
+ | </ | ||
===== ダウンロード ===== | ===== ダウンロード ===== | ||
行 47: | 行 103: | ||
[[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 のバージョン ===== | ||
行 90: | 行 220: | ||
<code powershell> | <code powershell> | ||
PS > start-process notepad c: | PS > start-process notepad c: | ||
+ | </ | ||
+ | |||
+ | ===== カレントディレクトリ変更 ===== | ||
+ | <code powershell> | ||
+ | PS C: | ||
+ | PS C: | ||
+ | |||
+ | Path | ||
+ | ---- | ||
+ | C: | ||
</ | </ | ||
行 101: | 行 241: | ||
[[http:// | [[http:// | ||
[[https:// | [[https:// | ||
+ | \\ | ||
+ | [[https:// | ||
+ | \\ | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||