Jump to content
Sign in to follow this  

Send to CMD command without close-open

Recommended Posts

Hello guys :D

I'll try to be as clear as possible. I have a commandline interface ( .com ) and i need to automize that. Pratically now i'll do this way:

1) Open cmd

2) i'll write "mycommandline.com -indentify a:"

3) i'll write "mycommandline.com -indentify b:"

4) i'll write "mycommandline.com -indentify c:"

and so on until Z


I want to do that process with autoit BUT i want to spawn only ONE single CMD.exe process and not 26 times :D

Suggestion or example to how accomplish this task?

Many thanks

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength


Share this post

Link to post
Share on other sites

write a single batch file with FOR loop A: to Z:

use AutoIt RunWait() to call that batch file.

here are some leads:



that batch file should also handle the result of your com app, if any, or deliver those to your AutoIt script. for example, redirect output for each drive to a text file, then let your AutoIt script process it.

Edited by orbs

Share this post

Link to post
Share on other sites

Since I have no mycommandline.com, I used Dir command:

$cmds = "("
For $i = 97 To 122   ; equals a to z
    $cmd = "dir " & Chr($i) & ":\ & "
    $cmds &= $cmd
$cmds &= "echo. ) >" & @ScriptName & ".txt 2>&1"
ConsoleWrite($cmds & @LF)
RunWait('"' & @ComSpec & '" /c ' & $cmds, '', @SW_HIDE)
ShellExecute(@ScriptName & ".txt")

UDF: _SingleScript()                                        If you like my post, just click the like button :)        here -->

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  

  • Create New...