From: x1 Date: 2005-09-11T11:54:16+09:00 Subject: Re: Problem with popen on windows Simon, this worked on my machine also --excellent! ---Question / Request: I tried stripping out the GUI stuff so that I could implement this 'solution' into my current needs (to no avail) I would like to use this as a replacement to popen(), could you help me strip this down into popen() form? After the read_file method, I tried keeping what appeared to do the actual work but.. no luck.. any suggestions? #-------------------------------------------------------------------------------------------------> cmd = 'cmd.exe' input = "c:\\temp\\test.bat\nexit\n" # create 3 pipes child_in_r, child_in_w = create_pipe child_out_r, child_out_w = create_pipe child_error_r, child_error_w = create_pipe # Ensure the write handle to the pipe for STDIN is not inherited. set_handle_information(child_in_w, HANDLE_FLAG_INHERIT, 0) set_handle_information(child_out_r, HANDLE_FLAG_INHERIT, 0) set_handle_information(child_error_r, HANDLE_FLAG_INHERIT, 0) processId, threadId = create_process(cmd, child_in_r, child_out_w, child_error_w) # we have to close the handles, so the pipes terminate with the process close_handle(child_out_w) close_handle(child_error_w) write_file(child_in_w, input) #-------------------------------------------------------------------------------------------------> # while !(buffer = read_file(child_out_r)).empty? # edit.appendText(buffer.gsub("\r", '')) # end thank you very much! On 9/10/05, Simon Kr�ger wrote: > x1 wrote: > > > I just found a fix that works for me.. I hope this helps someone else out... > > > > Nonetheless, it does require a small vb script, which acts as a > > parent for the child script.. to execute, the command is as follows: > > > > [code] > > WScript RunHide.vbs Cmd /C MyBatch.cmd > > [/code] > > Hmm, this might be a workaround but not realy a fix. At least not for my > problem. I don't want to distribute .vbs and .bat files. > > Perhaps my other post offers a solution for you, too? > > It's not very polished yet, but it does work (at least on my machine :)) > > cheers > > Simon > >