Chance1

Process wont run with opt_flags

5 posts in this topic

#1 ·  Posted

Hey guys, I am trying to run a process and use the stdin, stdout, stderr streams, but when I attach the opt_flags in the run;

$TNPid = Run('C:\Windows\System32\telnet.exe', '', @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)

The process opens and closes right away, not allowing for the commands to be sent to it. But If I have the run command like this:

$TNPid = Run('C:\Windows\System32\telnet.exe', '', @SW_HIDE)

It works fine, but I have to use ControlSend commands to write, and I am unable to get the stdout and error for the process.

 

Any ideas as to why this is happening? Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted

What about?:

$TNPid = Run(@comspec & ' /c telnet.exe', '', @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

When I tried it, it runs the command line and there is no telnet.exe running. I'll keep testing just to be sure.

Edited by Chance1

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

So, I have been messing with it. When I do this: 

$TNPid = Run(@comspec & ' /k telnet.exe' , '', '', $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD)

I am still getting that the command prompt window is running, even with the following commands to try and get telnet to run:

StdinWrite($TNPid, "C:" & @LF)
    StdinWrite($TNPid, "cd Windows\System32" & @LF)
    StdinWrite($TNPid, "telnet.exe" & @LF)

However, When I run this:

$TNPid = Run(@comspec & ' /k telnet.exe') ;or a /c

telnet.exe opens up right away. When it comes up, it have a title of "C:\Windows\System32\cmd.exe - telnet"

Edited by Chance1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now