Sign in to follow this  
Followers 0
Terenz

Send to CMD command without close-open

4 posts in this topic

#1 ·  Posted (edited)

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



#2 ·  Posted (edited)

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

use AutoIt RunWait() to call that batch file.

here are some leads:

http://superuser.com/questions/747009/dos-batch-script-to-iterate-through-ntfs-drives

http://www.computing.net/answers/programming/batch-file-drive-loop/18537.html

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

you could run more dos commands in one line using the & as separator

have a look >here


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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
Next
$cmds &= "echo. ) >" & @ScriptName & ".txt 2>&1"
ConsoleWrite($cmds & @LF)
RunWait('"' & @ComSpec & '" /c ' & $cmds, '', @SW_HIDE)
ShellExecute(@ScriptName & ".txt")

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

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  
Followers 0