fox icon indicating copy to clipboard operation
fox copied to clipboard

Convert Edge_Removal to pure PowerShell code

Open SamHills opened this issue 1 year ago • 0 comments

There are several ways that Edge_Removal can be sped up by converting it to pure PowerShell code instead of calling cmd.exe to call other programs to do things that PowerShell can do much faster using its own built-in cmdlets.

It looks like the program was originally written as a batch file and only partially converted to PowerShell. Some of the issues that need to be addressed:

  1. Instead of CMD /C REG ADD, use Set-ItemProperty.
  2. Instead of CMD /C REG DELETE, use Remove-ItemProperty.
  3. Instead of CMD /C dism /online, call the PowerShell cmdlet directly.
  4. Instead of using SET to edit strings, just use PowerShell's built-in string-editing cmdlets and functions.
  5. Convert Edge_Removal.bat to a .ps1 file, move the "run as administrator" code to the top. and test whether or not the program already has administrator privilege before spawning a new PowerShell window.

SamHills avatar Oct 12 '22 16:10 SamHills