Jump to content

Script called from Command Line


Recommended Posts

Hi,

is it possible in AutoIt to recognise when a script is being called from the command line (cmd.exe)?

And if yes, can you output text into the cmd.exe that called the script?

--WhiteAvenger

Yes you can get data from cmd.exe

An example to get data from cmd.exe:

#include <Process.au3>

Func DOS_STDOUT($LINE)
    _RunDOS($LINE & " >" & @TempDir & "\STD_OUT.TXT")
    Local $FILE = FileOpen(@TempDir & "\STD_OUT.TXT",0)
    Local $OUTPUT = FileRead($FILE)
    FileClose($FILE)
    Return $OUTPUT
EndFunc

MsgBox(0,"",DOS_STDOUT("VER"))

When the words fail... music speaks.

Link to comment
Share on other sites

As far as I know it's not possible to recognise if cmd.exe started the program.

It's also not possible to display text on console.

But you can send it without displaying.

Use ConsoleWrite for this.

for example:

;hw.au3
ConsoleWrite("hello world!")oÝ÷ ØÚ0ʦºË¢jbëaz趦bjw±yË­z+eG­+!Áì^Ú.¶­·X¢ì"WâØ^Z0¢¹]ßx§¢ëiºÛq´z)x(ºWazZDÈë-~§v­¶­Êjwb²ZÉɵìmo+¬x-à.¶-ÝjÚ¦«jëh×6#AutoIt3Wrapper_Change2CUI=y

ConsoleWrite("Hello World!")
Edited by Zonarius
Link to comment
Share on other sites

  • 3 weeks later...

As far as I know it's not possible to recognise if cmd.exe started the program.

It's also not possible to display text on console.

But you can send it without displaying.

Use ConsoleWrite for this.

for example:

;hw.au3
ConsoleWrite("hello world!")oÝ÷ ØÚ0ʦºË¢jbëaz趦bjw±yË­z+eG­+!Áì^Ú.¶­·X¢ì"WâØ^Z0¢¹]ßx§¢ëiºÛq´z)x(ºWazZDÈë-~§v­¶­Êjwb²ZÉɵìmo+¬x-à.¶-ÝjÚ¦«jëh×6#AutoIt3Wrapper_Change2CUI=y

ConsoleWrite("Hello World!")
thanks a bunch this is exacly what i was looking for i feel like a man now :)!

Carlos AnguianoSenior Technical Director/Pipeline EngineerRed magnet Studios Venice, CAhttp://www.redmagnetfx.com

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