Jump to content
Sign in to follow this  
WhiteAvenger

Script called from Command Line

Recommended Posts

WhiteAvenger

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

Share this post


Link to post
Share on other sites
Andreik

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

Share this post


Link to post
Share on other sites
Zonarius

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

Share this post


Link to post
Share on other sites
carlosa

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

Share this post


Link to post
Share on other sites
trancexx

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

...

SmOke_N would disagree


♡♡♡

.

eMyvnE

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.