0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

テキストファイルを「メモ帳」で開く(powershell スクリプト)

Last updated at Posted at 2021-06-05

こんにちは。
テキストファイルを「メモ帳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
  1. txt や ps1 ファイルは、「メモ帳」があらかじめ関連付けられたアプリケーションとなっています。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?