1
4

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 5 years have passed since last update.

PowerShellで日付を変数に直接展開する

Last updated at Posted at 2018-09-11

システム日付のファイルなどを作成する時に、

test.ps1
$today = Get-Date -Format yyyyMMdd
"$today.txt"

だと一度変数に展開しないといけないので

test.ps1
"$(Get-Date -Format yyyyMMdd).txt"

これだとわざわざ変数に展開せずに済む。

1
4
2

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?