Jump to content

Talking to a cmd prompt


cprowse
 Share

Recommended Posts

Hi all,

I am looking for an alternative to ConsoleWrite that will successfully output when calling a compiled script from a cmd prompt. I have successfully got output going to a log using '_FileWriteLog', but cannot get anything to output to the cmd screen.

Also, I seem to be having trouble getting exit codes to be picked up in the cmd screen. I compiled a script simply with the line:

"Exit 10"

Running this in Scite exits with the error code 10 (as expected) - however, calling the compiled script from a cmd prompt, and then running 'echo %ERRORLEVEL%' returns 0 (zero) every time. Am I just doing something stupidly?

Thanks all - apologies for so many newbie questions

-Chris

Link to comment
Share on other sites

Logi,

Thanks for the reply - the problem I am having is getting output into the cmd window (on XP) in which I am calling a compiled script. For example, create a new AutoIT script containing nothing more than:

ConsoleWrite("Printing something to the command line" & @LF)

And run this in an editor such as Scite - you get a nice output in the debug window showing the expected sentence.

However, now compile this script into an .exe. Open a cmd window, change to the directory containing the .exe and run it here. No output is printed - it simply returns from the script.

The ConsoleWrite help says "This does not write to a DOS console." - I'm just looking for an alternative?

Also, if this script were to use the Exit ($error_code) function - could I get the exit code in the cmd window when the script returns? echo %ERRORLEVEL% always seems to print '0'

Kind Regards,

-Chris

Link to comment
Share on other sites

okay if i understand your problem correctly:

You start the program from the commandprompt but the consolewrite doesn't work...

The ConsoleWrite help says "This does not write to a DOS console." - I'm just looking for an alternative?

This means the consolewrite doesnt write TO a CMD window.

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...