Passing data between the parent process and bat/cmd

Tech-Archive recommends: Fix windows errors by optimizing your registry



I have an unmanaged program that can be extended with custom batch scripts.
I use CreateProcess() to execute whatever has been specified by the user.
Most likely, it's a .bat/cmd file.

The user needs to have an easy way to specify several return values in the
batch file, so that these values can be processed by the parent executable.

Environment variables would be an ideal solution. The problem is, the batch
doesn't seem to be able to change the parent's environment variables.
Neither the parent can read the modified environment of the child process.

ERRORLEVEL is not enough, as the batch file needs to return string values.

stdout/stderr redirection is no good either, as the content of the batch
file (say, nested calls to other .bat files) may interfere with the output.

So my question is, what's and easy and effective way to pass several returns
values from a batch file to the parent executable?

Thanks,
Andrew



.



Relevant Pages

  • Re: Multi-zip files -- Windows server
    ... native DOS versions). ... TO BATCH OR NOT TO BATCH ... and using a batch file to try and solve the problem... ... The IBM PC operating system command line is a most ...
    (comp.sys.cbm)
  • Re: EWF RAM
    ... Do you mean it is running the stress test fine locally on the device? ... If it does and the issue has no repro, you should move to use local batch file approach in your support scenario. ... >> A tech plugs into it with laptop and remote desktops to it. ...
    (microsoft.public.windowsxp.embedded)
  • Re: Windows "Scheduled Task Wizard..."
    ... Do you know any links at Microsoft documents related to the batch file ... command name to get started. ... VB Script and any other Microsoft scripting languages have nice ...
    (microsoft.public.windows.server.general)
  • Re: How to AUTOMATICALLY prepend/pass a "/U" switch to cmd.exe when executing a *.bat batch file ?
    ... How do I specify that every time I execute a .bat by doubleclicking the /U should be ... As a workaround I could accept that the /U flag is not only used for a particular batch file ... If you can't find your previous post search for it using Google Groups Advanced Search. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: why cant i get variable value?
    ... i call this bath file in another batch file. ... batch executes the statement using the value AT PARSE TIME. ... @ECHO OFF ...
    (microsoft.public.win2000.cmdprompt.admin)