
PowerShellで
・ファイルを移動
できます!
コード
ここでは例として
・デスクトップ配下のファイル「aiueo.txt」を
・フォルダ「folder_001」へ移動
します。

# 移動するファイルのパス
$targetFilePath = "C:\Users\user\Desktop\aiueo.txt"
# 移動後のフォルダのパス
$newFolderPath="C:\Users\user\Desktop\folder_001"
$ws = New-Object -ComObject Wscript.Shell
try
{
# ファイル名を移動
Move-Item -Force $targetFilePath $newFolderPath -ErrorAction Stop
$ws.popup("ファイルを移動しました。")
}
catch
{
$ws.popup("エラー : " + $PSItem)
}
実行結果
ファイルを移動できました。


参考①
フォルダの移動もできます。
詳細は以下の記事をご確認ください。
XXX
参考②
上記のコードで使用した以下の詳細は、公式サイトをご確認ください。
●「Move-Item」コマンドレット
●例外処理について