Sign in to follow this  
Followers 0
scythetleppo

Run Batch File without DOS window?

8 posts in this topic

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



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

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

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

anyone?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

anyone?

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

[center]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.[/center]

Share this post


Link to post
Share on other sites

What are you Sending to?

Using WinWaitActive before WinActivate is going to accomplish little as WinWaitActive is waiting for the window to be active.

This may help

WinWait( "Installing" )
If Not WinActive( "Installing" ) Then
    WinActivate ( "Installing" )
EndIf
WinWaitActive ( "Installing" )

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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  
Followers 0