Refactor notepad replacement in WinPE
The registry method has proved problematic. This DOSKEY method seems less error prone since it's evaluated at runtime.
This commit is contained in:
parent
3621914312
commit
6a5a944ea0
3 changed files with 2 additions and 10 deletions
|
|
@ -1,3 +0,0 @@
|
|||
@echo off
|
||||
|
||||
start "" "%SystemDrive%\Program Files\NotepadPlusPlus\notepad++.exe" %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
notepad="%ProgramFiles%\NotepadPlusPlus\notepad++.exe" $*
|
||||
poweroff=wpeutil shutdown
|
||||
reboot=wpeutil reboot
|
||||
restart=wpeutil reboot
|
||||
shutdown=wpeutil shutdown
|
||||
shutdown=wpeutil shutdown
|
||||
|
|
|
|||
|
|
@ -346,12 +346,6 @@ if ($MyInvocation.InvocationName -ne ".") {
|
|||
$Hive.close()
|
||||
$RegKey.close()
|
||||
|
||||
# Replace Notepad
|
||||
$RegPath = "HKLM:\WinPE-SW\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe"
|
||||
$NewValue = 'cmd /c "%ProgramFiles%\NotepadPlusPlus\npp.cmd"'
|
||||
New-Item -Path $RegPath -Force | Out-Null
|
||||
New-ItemProperty -Path $RegPath -Name "Debugger" -Value $NewValue -Force | Out-Null
|
||||
|
||||
# Run garbage collection to release potential stale handles
|
||||
## Credit: https://jrich523.wordpress.com/2012/03/06/powershell-loading-and-unloading-registry-hives/
|
||||
Start-Sleep -Seconds 2
|
||||
|
|
|
|||
Loading…
Reference in a new issue