Jump to content

Recommended Posts

Hello everybody,

I try to write in cmd but when I make script with send("blabla") autoit write nothing, I've tried to put "WinSetOnTop()" but that write nothing,

Although cmd has no control ID I can't put "ControlSetText"....

Anyhelp ?

No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE
Link to post
Share on other sites

I have no idea how ShellExecute() works, but I've used the cmd prompt for things with success.

I needed to change some settings under the Control Panel, my script used the command prompt to call the windows I wanted.

Maybe your cmd window wasn't active? Anyway, it's safer to use a ControlSend.

Here's what I used in my script:

Run("cmd.exe")
winwaitactive("C:\WINDOWS\sys")
ControlSend("C:\WINDOWS\sys","","","Write crap here!")
ControlSend("C:\WINDOWS\sys","","","{ENTER}")
Edited by Nevin
Link to post
Share on other sites

i use a simple RunWait()

example script that kills and restarts the print spooler as admin

RunAsSet("user", "domain or @computername", "password")
RunWait('cmd /c net stop "print spooler"')
RunWait('cmd /c net start "print spooler"')
Sleep(500)
RunWait('cmd /c net stop "print spooler"')
RunWait('cmd /c net start "print spooler"')

RunAsSet()
Link to post
Share on other sites

Sexy. I didn't know you could do that. I also didn't know about the /c parameter. I'm confused about what it does. I thought it would close the window, but I just tried to put "cmd /c control" into Start Menu>Run and it opened the control panel as expected, but also opened a blank DOS window.

Link to post
Share on other sites
  • Moderators

Sexy. I didn't know you could do that. I also didn't know about the /c parameter. I'm confused about what it does. I thought it would close the window, but I just tried to put "cmd /c control" into Start Menu>Run and it opened the control panel as expected, but also opened a blank DOS window.

/c = close

/k = keep open

You have to use the run method to see.

RunWait('cmd /c '); will close right away
MsgBox(0, 0, 0)
RunWait('cmd /k '); will stay open until you close it

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites

Sexy. I didn't know you could do that. I also didn't know about the /c parameter. I'm confused about what it does. I thought it would close the window, but I just tried to put "cmd /c control" into Start Menu>Run and it opened the control panel as expected, but also opened a blank DOS window.

/c = close

/k = keep open

You have to use the run method to see.

RunWait('cmd /c '); will close right away
MsgBox(0, 0, 0)
RunWait('cmd /k '); will stay open until you close it

Ya tha'ts basically all it does is just runs the command and closes so there's nothing left over when the script finishes

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...