Note that there is already exec.dll which pipes in/out from shell and provides this /exec and $exec command. However I'm not sure if it works in 7.x.