Jump to content

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

 

Link to comment
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:

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

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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")

App: Au3toCmd              UDF: _SingleScript()                             

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