Jump to content

How to send command to Command prompt


ThomasQ
 Share

Recommended Posts

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...