Hello,
I am trying to find a way to run a launcher script (batch or vbs) that would run instead of the called program, would perform some actions, and then launch the said program. I plan on doing this through the use of the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\currentversion\image file execution options\ManagedExe.exe, with theDebugger value defined as the launcher script.
The problem is that when the script calls the program, the script is run again because the key is still there saying to call the script. That would start an endless loop.
I found 2 ways to get around this, but I dislike them both :
1. At the start of the script, remove the debugger key, perform the actions, call the program, then reset the key. But that means the user could run the program directly during that time.
2. Copy and rename the program to %temp% and run it from there. But this is not very clean.
I think there is yet another way, through the use of WMI CreateProcess with the DEBUG_PROCESS option. But I don't quite understand how this works. It is mentionedhere with not many details.
Could some one help me with this please ?
Thanks