0
1

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.

ファイルの作成日時、更新日時を変更したい

Last updated at Posted at 2021-06-01

背景

保存期間の過ぎたファイルを削除する機能を実装する際、テスト用のファイルを作成する必要が
あり個人的に困ったので自分メモ用に。

PowerShellで日時を変更するコマンド

※PowerShellは管理者権限で実行する

// 作成日時変更コマンド
Set-ItemProperty ファイルパス -Name CreationTime -Value "変更したい日時"

// 更新日時変更コマンド
Set-ItemProperty ファイルパス -Name LastWriteTime -Value "変更したい日時" 

実行結果

image.png

image.png

image.png

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?