Jump to content
Sign in to follow this  

Print to command line?

Recommended Posts

Hey everyone,

I am currently in the process of coding a program for command line use, and I want to be abe to print back to the command line, like this:

Output from my program

Any ideas? Here is what I have already tried: (myprogram.au3)

$MyCommand = 'dir'
Run(@ComSpec & " /c " & $MyCommand, @SystemDir, @SW_Show)
   Run(@ComSpec & " /c @echo off && echo Command completed successfully. && @echo on && pause", @SystemDir, @SW_Show)

The output from this ended up opening three windows, from window 1 (command line) I ran "myprogram" whcih in turn opened another window for the "dir" and yet another window to print back "Command completed successfully." I am looking for a way to do this all in the same window, to write to the active shell so to speak.

Thanks for any help!

Share this post

Link to post
Share on other sites

Every time you do a "Run(@ComSpec...", it's going to open a new window.

To write to the console, look at ConsoleWrite(). As the help file says, you'll have to compile your script as a console application.

Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...