iRun_SYS always fails GX Developer 9.1

I am attempting the run some commands through the command prompt using the iRun_SYS command with GX Developer 9.1 and the function always fails. The parameters that I am passing are the same that I used for a GX with 8.5 that worked. The API is the same for the two Developer versions.

How can I run commands through the command prompt from a GX with Developer 9.1?

Comments

  • Hi Tim,

    What errors are you getting when running iRun_SYS?

    I would recommend to look at the source code for winexec.gx in the gx\src\winexec folder. It makes use of all the parameters and may help you out in debugging.

    Regards,
    Joseph
  • I looked at the source code for winexec.gx and tested the same parameters that I am using for my GX and winexec is able to run.

    For some reason, when I used the same line of code, my gx fails (iRun_SYS = -1) and does not even launch the command prompt.

    iRun_SYS(sCMD,sCL,iType+iExit+iWait);

    where

    sCMD is "..\Windows\System32\cmd.exe"
    sCL is a string of my parameters
    iType = SYS_RUN_TYPE_WINDOWS;
    iExit = SYS_RUN_HOLD_ONERROR;
    iWait = SYS_RUN_WIN_WAIT;

    I have even tried running a version of winexec compiled and run from the same folder as my gx which works, while my gx iRun_SYS returns -1.
  • Hi Tim,

    Are you specifying a relative path to cmd.exe? If so, try using the full path.

    See if this line of code works for you:
    iRun_SYS("C:\\Windows\\System32\\cmd.exe","/c ping www.google.com",SYS_RUN_TYPE_WINDOWS+SYS_RUN_HOLD_ONERROR+SYS_RUN_WIN_WAIT);

    Regards,
    Joseph
This discussion has been closed.