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

# ファイルパスを設定
$filePath = "C:\Users\user\Desktop\aiueo.txt"
$ws = New-Object -ComObject Wscript.Shell
try
{
# ファイルを削除
Remove-item -Force $filePath -ErrorAction Stop
$ws.popup("ファイルを削除しました。")
}
catch {
$ws.popup("エラー : " + $PSItem)
}
実行結果
ファイルを削除できました。

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