Jump to content
Sign in to follow this  
d3mon

Write in cmd

Recommended Posts

d3mon

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

Share this post


Link to post
Share on other sites
d3mon

Why not just execute the command, with ShellExecute()?

Yes....Thanks lol


No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE

Share this post


Link to post
Share on other sites
d3mon

What is the parameters for write in cmd ?


No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE

Share this post


Link to post
Share on other sites
Nevin

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

Share this post


Link to post
Share on other sites
tlman12

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()

Share this post


Link to post
Share on other sites
Nevin

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.

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
tlman12

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

Share this post


Link to post
Share on other sites
d3mon

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

Yep, thanks for all answers !


No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.