I figured out a better way
On Vista and Win7, with this method, you don't have to take ownership of any
files and this is easily reversible
you are welcome to include this with your program
'// DISCLAIMER
'// THIS COMES WITH NO WARRANTY, IMPLIED OR OTHERWISE. USE AT YOUR OWN RISK
'// IF YOU ARE NOT COMFORTABLE EDITING THE REGISTRY THEN DO NOT USE THIS SCRIPT
'//
'// NOTES:
'// This affects all users, the same key under HKCU did not work for me
'// This vbscript was written by selyb on 08-28-09
'// This txt looks no good with word wrap on :-P
'//
'// Save this text to your hdd as a text file named *.vbs e.g. "C:\IFEO.vbs"
(some AV don't like vbs, get a different AV :-P )
'//
'// USAGE
'// 1)
'// Navigate to registry key HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Image File Execution Options\
'//
'// 2)
'// Add new subkey with the name of the executable you want replaced (no path)
e.g. notepad.exe
'// This step is what tells windows to use the replacement exe, to undo
simply
delete the key you created
'//
'// 3)
'// Create new Sting Value called Debugger
'//
'// 4)
'// Modify value and enter wscript.exe "path to this vbs" e.g. wscript.exe
"C:\IFEO.vbs"
'//
'// 5)
'// Under DEFINITIONS section below, create a new definition using an example as
a template
'// If you add the registry entry and then try to execute it without creating a
definition,
'// this file will open automatically in notepad
'// The definitions below will do NOTHING without the corresponding subkey
created in step 2
Option Explicit
Dim sCmd, sFol, x, bWait, W
Set W = CreateObject("WScript.Shell")
sCmd = Split(WScript.Arguments(0), "\")
x = LCase(sCmd(UBound(sCmd)))
bWait = False
Select Case x
'// DEFINITIONS
'// Map
'// This must be lower case and must be the exact same name of the subkey you
created in the registry
' Case "notepad.exe"
'// This is the command to be executed, you can put command line parameters here
too
' sCmd = "replacement.exe"
'// This is the path you want the command executed from (may be omitted)
' sFol = "C:\Program Files\Replacement"
'// If true, wscript.exe will not terminate until the replacement is closed
(False if omitted)
'// I needed this true with notepad.exe because 7-zip would delete the file
before the replacement would open it >:-/
' bWait = True
'// example 1 (remove the single quot marks after you paste)
'Case "notepad.exe"
'sCmd = "replacement.exe /y /z"
'sFol = "C:\Program Files\Replacement"
'bWait = True
'// example 2 (If sCmd has a space in the name, you need triple quotes)
'Case "calc.exe"
'sCmd = """C:\Users\My Name\Downloads\newcalc.exe"""
'// example 3 (If sCmd has a space and you need additional command line params,
it gets complicated)
'Case "taskmgr.exe"
'sCmd """C:\one folder\two folder\new app.exe"" /x /y /z"
'sFol """C:\windows\system32"
'// END OF DEFINITIONS
Case else
W.Run "notepad.exe """ & WScript.ScriptFullName & """", 8, False
WScript.Sleep(2000)
WScript.Echo x & " not defined yet." & vbNewLine & "Please add
definition for
it."
WScript.Quit
End Select
If LenB(sFol) Then W.CurrentDirectory = sFol
For x = 1 To WScript.Arguments.Count - 1
sCmd = sCmd & " """ & WScript.Arguments(x) & """"
Next
W.Run sCmd, 1, bWait
WScript.Quit
--
<http://forum.pspad.com/read.php?2,50774,50818>
PSPad freeware editor http://www.pspad.com