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-09
# コピー元を指定
Set-Location \\199.22.99.00\test

# コピー先を指定
$locallink = "コピー先URLを設定"

# 本日の日付を取得 例)20210101
$formatted_date = (Get-Date).ToString("yyyMMdd")

# コピーしたいファイル名を設定 例)テスト2021.xlsx
$copyfilename = "テスト" + $formatted_date + ".xlsx"

# コピーしたいファイルをコピー先URLにコピー
Copy-Item -Path $copyfilename -Destination $locallink

# リネームするファイルのURLを設定
$renamelink = $locallink + "\" + $copyfilename

# リネーム後のファイル名を設定 例)テスト20210101_テスト.xlsx
$renamefile = "テスト" + $formatted_date + "_テスト" + ".xlsx"

# リネーム
Rename-Item $renamelink $renamefile


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?