Jump to content
Sign in to follow this  

Newbie needs help

Recommended Posts


Hello everyone.  I'm brand new to AutoIT.

I wanted to create a script to open a command window as Administrator and then enter some commands into that window.

I created the following script to run a test:

   ; Script Start - Add your code below here

   #include <AutoItConstants.au3>
   #include <MsgBoxConstants.au3>

   Local $hWnd = WinWait("Administrator: C:\Windows\system32\cmd.exe", "", 10)
   MsgBox($MB_SYSTEMMODAL, "", "Handle: " & $hWnd)
   Send ("dir")

The command window opens up, the message box prints the handle number and then nothing.  The "dir" command does not get sent to the command window.

What am I doing wrong?


Thank you for helping!

Edited by TLOlivier

Share this post

Link to post
Share on other sites

Hi, @TLOlivier welcome to the forum. Can you please expand on what exactly you're trying to accomplish? You can do a RunAs, and do most anything you would be able to do from the command line, without actually opening a command window.

√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post

Link to post
Share on other sites

I would like to run the following command to change the DNS setting on a computer:

     netsh interface ip set dns name="Local Area Connection" static

If there is a quote in the command, do I do a double quote to get AutoIT to recognize the quote?


Thank you!

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