I'm using qWords code snippet for CreateProcess
.if !rv(CreateProcess,"c:\Windows\System32\wevtutil.exe","el",0,0,0,CREATE_NEW_CONSOLE or CREATE_NEW_PROCESS_GROUP,0,0, ADDR sui,ADDR pi)
which works fine how ever if I add commands to the lpCommandLine I get syntax errors or nesting errors.
I've tried ,"el"">>test.txt",
,"el" ">>test.txt",
, "el" ">>" "test.txt",
and many more
I'm trying to pipe the output to a file so that I can parse it.
That kind of nesting with quoted strings is not possible with MASM. However, you can use escape sequences with the rvc or rvcx macros:
rvc(CreateProcess,"\\Windows\\System32\\cmd.exe","/K \q\\Windows\\System32\\ping.exe www.masmforum.com \r xyz.txt\q",0,0,0,CREATE_NEW_CONSOLE,0,0, ADDR sui,ADDR pi)
For the syntax of the macros, please take a look into hlhelp.chm.
there are several caveats when passing the command line with parameters
read the documentation for CreateProcess - lpCommandLine in particular
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx)
what i find works best is to pass a NULL for lpApplicationName and
create the complete command line as a single string - for example...
'c:\masm32\ml.exe parm',0
of course, you don't need the full path if the file is in the same folder or in the environment PATH