Jump to content
Sign in to follow this  
scythetleppo

Run Batch File without DOS window?

Recommended Posts

scythetleppo

How can this be done? Echoing off turns the echo off but there's still a black window.

Share this post


Link to post
Share on other sites
big_daddy

How can this be done? Echoing off turns the echo off but there's still a black window.

Use @SW_HIDE as the flag for the run command, like so.

Run("filename", "", @SW_HIDE)

Share this post


Link to post
Share on other sites
NELyon

i thought run could only run .exe's and .com file. i didn't know it could to .bat

Share this post


Link to post
Share on other sites
scythetleppo

ok yeah that does work but now I have another problem.

Now that the window is hidden, this doesn't work:

Run ( "C:\temp.bat", "", @SW_HIDE) 
WinWaitActive ( "Installing" ) 
WinActivate ( "Installing" ) 
Sleep ( 500 ) 
Send ( "1" ) 
Sleep ( 500 ) 
Send ( "{ENTER}" ) 
Sleep ( 500 )

because it never becomes active.

any ideas on how to send it 1 and then enter like that?

Share this post


Link to post
Share on other sites
SmOke_N

anyone?

Why not just try If WinExists()? And use ControlSend() rather than Send() Edited by SmOke_N

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
new2autoit

Hello Everyone !

scythetleppo, what OS are you running? I looked at your code and try this to exit the black screen in the back. I don't think you can hide it because if you do then the "WinWaitActive" is never going to execute. Try this to exit the background. Also you might want to read this

dim $root
run("cmd")
$root= EnvGet("systemroot")
Send("{space}")
;exits cmd
send( "chdir /d" & $root & "{enter}" & "cd \ {enter}" & "test.bat {enter} exit {enter}" )
;use your winwaitactive here. Hopefully it works

Hope it works. :D

Edited by new2autoit

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.