<p>I have a Windows executable (whoami) which is crashing every so often.  It's called from another process to get details about the current user and domain.  I'd like to know what parameters are passed when it fails.</p>

<p>Does anyone know of an appropriate way to wrap the process and write it's command line arguments to log while still calling the process?</p>

<p>Say the command is used like this:
'whoami.exe /all'</p>

<p>I'd like a script to exist instead of the whoami.exe (with the same filename) which will write this invocation to log and then pass on the call to the actual process.</p>

You didn't note which programming language. It is not doable from a .bat file if that's what you wanted, but you can do it in any programming language. Example in C:
```
```
int main(int argc, void **argv)
{
    // dump contents of argv to some log file
    int i=0;
    for (i=0; i<argc; i++)
        printf("Argument #%d: %s\n", argv[i]);
    // run the 'real' program, giving it the rest of argv vector (1+)
    // for example spawn, exec or system() functions can do it
    return 0; // or you can do a blocking call, and pick the return value from the program
}
```
```