こんにちは。
テキストファイルを「メモ帳1」(notepad) で開く powershell スクリプトを作りました。
txt や ps1 ファイルを指定できます。既存ではないファイル名を指定した場合には新規作成します。
PS> .\edit-text-file.ps1 test.txt
edit-text-file.ps1
# Encoding::Shift-JIS
Param($file, $string)
if (-Not(test-path $file)) {New-Item $file -ItemType "file"}
Write-Output $string | Out-File -FilePath $file -append # ファイルへ指定した文字列を書き加える
Invoke-Item $file
-
txt や ps1 ファイルは、「メモ帳」があらかじめ関連付けられたアプリケーションとなっています。 ↩