2023/12/30 PowerShellのプロンプト文字列を変更する方法 PowerShell PowerShell Tips はじめに PowerShellのプロンプトはデフォルトで「PS [現在のディレクトリ] >」と出力されるため、 「C:\aaa\bbb\ccc\ddd\eee\fff\ggg\hhh\iii\jjj」の
2023/12/29 PowerShell起動時に表示されるメッセージを消す方法 PowerShell PowerShell Tips はじめに Windows PowerShellは起動時に以下のメッセージが表示されます。 Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. 新しいクロスプラットフォームの PowerShell をお試しください https://aka.ms/pscore6 PowerShell Coreも同様に起動時に以下のメッセージが表示されます。 PowerShell
2023/12/23 PowerShellで認証を実施する際のパスワードを暗号化する方法 PowerShell PowerShell Tips はじめに PowerShellスクリプトで認証を伴う処理を実施する際に、パスワードを暗号化して保持する方法のメモです。 パスワードファイルの作成 以下、ユーザー名「User1」、ファイル名「passwd.d
2023/12/22 PowerShellでメソッドの戻り値を標準出力に表示させない PowerShell PowerShell Tips PowerShellはメソッドの戻り値が標準出力に表示される PowerShellでArrayList.Add()などの戻り値のあるメソッドを実行すると、標準出力に戻り値が表示されます。 1 2 3 4 5 6 $array =
2023/12/21 PowerShell 7でバッチ処理が文字化けする PowerShell PowerShell Tips はじめに Windows PowerShell 5.1からPowerShell 7に変更したところ、CSVを取り込むバッチ処理で文字化けが発生。 文字化けの原因 原因は、PowerShell 5.1ではデフォルトエンコードがShift_JISで
2023/12/19 PowerShellで自動的にリソース開放する PowerShell PowerShell Tips リソースの開放について StreamReaderなどでファイルをOpenした場合、Close()を忘れたり、Close()前にエラーで処理が終了してしまうとファイルがオープンされたままになります。 1 2 3
2023/12/14 PowerShell実行ポリシーの確認・変更方法 PowerShell PowerShell Tips PowerShellの実行ポリシーについて PowerShellの実行ポリシーは、スクリプトを実行する条件を制御する安全機能です。 Windowsクライアントマシンでは悪意のあるスクリプトの実行を防止のた