Sign in to follow this  
Followers 0
ThomasQ

How to send command to Command prompt

2 posts in this topic

Hi!

Just a quick n00b question. How do I use autoit to type and send commands trough command prompt (CMD)?

I'm just trying to encorperate one action in my script.

Thanks in advance!!

Share this post


Link to post
Share on other sites



Hi!

Just a quick n00b question. How do I use autoit to type and send commands trough command prompt (CMD)?

I'm just trying to encorperate one action in my script.

Thanks in advance!!

What action are you trying to incorporate?

You can use Run,Runwait, shellexecute, shellexecutewait directly to run any command outside of the CMD interpreter (ipconfig, netstat, etc).

If it is an internal CMD command (copy, dir, etc) you can invoke the CMD interpreter with the @ComSpec macro:

Run(@ComSpec & ' /k dir c:\', '', @SW_HIDE)

Run(@ComSpec & ' /c dir c:\', '', @SW_HIDE)

/k will keep cmd open when done with the command, /c will cause it to close.

If you need to interact with a console app which uses standard input/output, look at run combined with $STDOUT_CHILD options, in conjunction with stdoutread, StdinWrite.

Alternatively you can also blindly use "send" on an open console window.

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