Sign in to follow this  
Followers 0
Powder81

cmd.exe question

7 posts in this topic

hello, i am building a program wich will use the cmd.exe.

i have everything working except one little problem.

my script works fine as long as the cmd.exe window is active.

i dont want the cmd.exe window to be active, i want it hidden.

so here comes my problem, how do i send my "commands" to the hidden window?

Run("cmd.exe","whatever directory needed",@SW_SHOW)
sleep(3000)
Send("FTP{ENTER}")
sleep(3000)
Send("open ftp-ip{ENTER}")
sleep(3000)
Send("username{ENTER}")
sleep(3000)
Send("password{ENTER}")
sleep(3000)
Send("mput{ENTER}")
sleep(3000)
Send("blah.txt{ENTER}")
sleep(3000)
Send("y{ENTER}")
sleep(3000)
Send("bye{ENTER}")
sleep(3000)
Send("EXIT{ENTER}")

Thats a generalized code, no personal info in it.

That code works fine like i said, but how do i use the Send() when the cmd.exe is hidden?

Thanks alot for your help.


[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.

Share this post


Link to post
Share on other sites



the best can be to create a .cmd file you run.

In Fact cmd is opening a windows that is different from regular windows so ControlSend which work on non active window cannot work in this case.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

hello, i am building a program wich will use the cmd.exe.

Send("FTP{ENTER}")
why do you use cmd.exe if you actually want to run ftp.exe?

also i'd advice you to use WinWaitActive after using Run to make sure the window is active.

Edited by torsti

Share this post


Link to post
Share on other sites

yea, i suggest u do what jpm said, just write a batch/cmd file and run that instead of sending text to cmd.exe


FootbaG

Share this post


Link to post
Share on other sites

That or BlockInput(1). I had to do that for my SSH tunneling program, since its run on the command line too.


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Thanks alot everyone, i think you have helped me alot.

I really appreciate your support.


[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.

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
Sign in to follow this  
Followers 0