- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2020-07-27T01:32:52+00:00","default:admin","admin")
#author("2021-12-07T05:56:31+00:00","default:admin","admin")
-[[ヒアドキュメントを使って複数行を 1 つの文字列にする:https://bayashita.com/p/entry/show/50]]
*変数展開 [#o6f82a38]
**オブジェクト変数 [#a30b4e07]
-$obj.SomeProp を展開したい場合、$()で包んで評価する。
"値は $($obj.SomeProp)"
*連結 [#neb94696]
-[[PowerShellで文字列を結合する方法 5選:https://www.tekizai.net/entry/powershell_string_concat_1]]
*分割 [#ua20cd17]
-[[PowerShellでのSplitによる文字列の分割とは?基本を紹介!:https://www.fenet.jp/dotnet/column/tool/6740/]]
*置換 [#uea32b4f]
-[[PowerShellでテキストファイル内の文字列を置換する方法:https://win.just4fun.biz/?PowerShell/%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%86%85%E3%81%AE%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E7%BD%AE%E6%8F%9B%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95%E3%83%BBreplace%2C+creplace]]
-大文字小文字区別しない:-repalceの左側に置換前文字列、右側に置換後の文字列を指定
> "windows" -replace "w", "W"
WindoWs
-大文字小文字区別する:-crepalceの左側に置換前文字列、右側に置換後の文字列を指定
> "win Win WIN" -creplace "win", "Win"
Win Win WIN
*文字列をコマンドとして実行 [#x9e3d50f]
-[[PowerShellで文字列をコマンドとして実行する・Invoke-Expression:https://win.just4fun.biz/?PowerShell/%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%A8%E3%81%97%E3%81%A6%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B%E3%83%BBInvoke-Expression]]
> $cmd = "get-childitem $target"
> Invoke-Expression $cmd