One Line Command Prompt that makes a PendingFileRenameOperations entry

Run this at command prompt with Administrator privileges:

echo Add-Type -TypeDefinition @'>test.ps1&echo.using System;using System.Diagnostics;using System.Runtime.InteropServices;public static class Kernel32{[DllImport("kernel32.dll",CharSet=CharSet.Unicode,SetLastError= true)] public static extern bool MoveFileEx(String lpExistingFileName,String lpNewFileName,uint dwFlags);}>>test.ps1&echo.'@>>test.ps1&echo.[Kernel32]::MoveFileEx("c:\deletethisfile.txt",0,4)>>test.ps1&echo.>>rwong.ps1&powershell -executionpolicy bypass -File test.ps1




Registry entry now has a PendingFileRenameOperations entry:

Returns false if it fails.


Popular Posts