Jump to content

Command Line Execution


Recommended Posts

I am running a autoit script from the command prompt. But on running "C:\Program Files (x86)\AutoIt3\autoit3_x64.exe " & "c:\Users\opc\Desktop\AutoIt\Test_Copy.au3" the script is executing in the background and the command line exits. I want the command prompt to show execution of the script and act as a console so that whatever i write in ConsoleWrite function gets printed to the command prompt.

Link to comment
Share on other sites

You can have something like that for scripts that are not compiled.

"C:\Program Files (x86)\AutoIt3\autoit3_x64.exe" "c:\Users\opc\Desktop\AutoIt\Test_Copy.au3" | more

 

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

7 minutes ago, Andreik said:

You can have something like that for scripts that are not compiled.

"C:\Program Files (x86)\AutoIt3\autoit3_x64.exe" "c:\Users\opc\Desktop\AutoIt\Test_Copy.au3" | more

 

when i run this it pauses command prompt but the console output are not printed sequentially they all are printed at once. for example if i run the below script "hello"  and "execution finished" are not printed at an interval of 10 sec but printed ate simultaneously after 10 sec.

ConsoleWrite("hello")
Sleep(10000)
ConsoleWrite("Execution Finished")

 

Link to comment
Share on other sites

That's true and it's because the output of the script is not redirected until you send the end of line. If you don't like this behavior just compile the script as executable.

This could be fix like this:

ConsoleWrite("hello" & @crlf)
Sleep(10000)
ConsoleWrite("Execution Finished")

 

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

9 minutes ago, Andreik said:

That's true and it's because the output of the script is not redirected. If you don't like this behavior just compile the script as executable.

I have converted it into exe file and running using this command "C:\Users\opc\Desktop\AutoIt\RunTest.exe" | more but no changes, hello and execution finished are printed simultaneously. 

Link to comment
Share on other sites

39 minutes ago, Andreik said:

That's true and it's because the output of the script is not redirected until you send the end of line. If you don't like this behavior just compile the script as executable.

This could be fix like this:

ConsoleWrite("hello" & @crlf)
Sleep(10000)
ConsoleWrite("Execution Finished")

 

adding @CRLF does the work😀. Thanks @Andreik

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...