I want to alter some arguments passed to application by wrapping it into inspectable script.
CMD.exe is out of list because it damages original arguments list (=
, ,
& ;
are treated as command separator, rendering --opt=val
into --opt
+ val
).
I though about JScript but was frustrated by the fact that both Wscript.Shell
with Run
+ Exec
& Shell.Application
with ShellExecute
create new window instead of attaching to existing console.
It is vital for wrapper to pass STDIO control to launched app. Regular Batch files follow such semantic, CLI pipe to the app continue to work even if the app is called through .cmd
wrapper.
Are you looking for something like this?
launchApplication.vbs
Then invoke it using
cscript.exe
. For example:Assuming your console
application.exe
actually accepts--opt=val
, then the above script should be capable of capturing the command-line args used to call application.exe, as well as the stdout and stderr from application.exe.If needed, it can also be modified to alter the command-line arguments, prior to executing application.exe.