3テラバイト

プログラム関連備忘録サイト。主にゲーム。

PowerShell

PowerShellでアイテムのコンテンツを取得するコマンドレットGet-Contentの使い方

投稿日:

こんにちは、今日はPowerShellでアイテムのコンテンツを取得するコマンドレットGet-Contentの使い方についてまとめていきます。

確認環境

PSVersion 5.1.18362.1110

Get-Contentの使い方

引数にコンテンツを取得したいアイテムを指定します。

以下の例ではカレントディレクトリにあるテキストファイル「test.txt」のコンテンツを取得しています。

PS C:\Users\santerabyte> Get-Content .\test.txt
test.txt contents.

リンク

Get-Content (Microsoft.PowerShell.Management) – PowerShell | Microsoft Docs
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-content?view=powershell-7.1

-PowerShell


comment

メールアドレスが公開されることはありません。

関連記事

no image

PowerShellでWindows Management Instrumentation (WMI)オブジェクトを取得するコマンドレットGet-WmiObjectの使い方

こんにちは、今日はPowerShellでWindows Management Instrumentation (WMI)オブジェクトを取得するコマンドレットGet-WmiObjectの使い方についてま …

no image

PowerShellでテキストファイルを1行ずつ処理する

こんにちは、今日はPowerShellでテキストファイルを1行ずつ処理する方法についてまとめていきます。 確認環境 PSVersion 5.1.18362.1110 テキストファイルを1行ずつ処理する …

no image

PowerShellでアイテムのプロパティを設定するコマンドレットSet-ItemPropertyの使い方

こんにちは、今日はPowerShellでアイテムのプロパティを設定するコマンドレットSet-ItemPropertyの使い方についてまとめていきます。 確認環境 PSVersion 5.1.18362 …

no image

現在実行中のタスク一覧をtasklistで取得する

確認環境 PowerShell 5.1 使い方 tasklist リンク tasklist | Microsoft Docshttps://docs.microsoft.com/ja-jp/windo …

no image

PowerShellで現在の日時を取得するコマンドレットGet-Dateの使い方

こんにちは、今日はPowerShellで現在の日時を取得するコマンドレットGet-Dateの使い方についてまとめていきます。 確認環境 PSVersion 5.1.18362.1110 Get-Dat …