# コピー元を指定
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
More than 3 years have passed since last update.
POWERSHELL ファイルをコピーしてファイル名をリネーム
Last updated at Posted at 2021-06-09
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme