Jump to content

Issue multiple dos commands


mrrlg
 Share

Recommended Posts

Is there a way to issue multiple commands, in sequence, within a single dos session. Here is what I am attempting to script. Open a dos window, change to a directory, issue a command, type in a password (it will not show on the screen) and then issue a series of @ statements, one after another. Here is what it looks like on paper:

cd %Oracle_Home%\rdbms\admin

sqlplus "sys as sysdata"

enter password:

SQL> @utlgdk.sql

SQL>@prvtgdk.plb

SQL>@prvtbfla.plb

SQL>@catexp.sql

SQL>@catproc.sql

EXIT

Link to comment
Share on other sites

No matter what I try I can't get past the first four lines of this script.

Opt("WinTitleMatchMode",4)

Run("cmd")

WinWait("ClassName=C:\Windows\system32\cmd.exe")

$hWnd = WinGet Handle("ClassName=C:\Windows\system32\cmd.exe")

ControlSend($hWnd,"","C:\oracle\ora81\rdbms\admin","cls{enter}")

The above line doesn't appear to execute. I'm left with an open dos window with the promt in the drive and directory in which the autoit script is contained.

Link to comment
Share on other sites

This works very well. :idiot:

Definitely useful.

Opt("WinTitleMatchMode",4)
Run("cmd", @SystemDir, @SW_MINIMIZE)

WinWait("classname=ConsoleWindowClass")
$hWnd = WinGetHandle("classname=ConsoleWindowClass")

ControlSend($hWnd,"","","cls{ENTER}")
ControlSend($hWnd,"","","dir{ENTER}")
ControlSend($hWnd,"","","pause{ENTER}")

@mrrlg:

Try this.

Opt("WinTitleMatchMode",4)
Run("cmd", @SystemDir)

WinWait("classname=ConsoleWindowClass")
$hWnd = WinGetHandle("classname=ConsoleWindowClass")

ControlSend($hWnd,"","","C:\oracle\ora81\rdbms\admin{ENTER}")
ControlSend($hWnd,"","","cls{ENTER}")
Edited by SlimShady
Link to comment
Share on other sites

I have tried this script in a couple of different ways and it still hangs at the ControlSend line.

I have tried it using ConsoleWindowClass and by inserting the name of the window shown in parentheses on the right and it makes no difference. What am I missing?

Opt("WinTitleMatchMode",4)

Run("cmd", @SystemDir)

WinWait("classname=ConsoleWindowClass"); (C:\Windows\system32")

$hWnd = WinGetHandle("Classname=ConsoleWindowClass"); (C:\windows\system32")

ControlSend($hWnd," "," ","C:\oracle\ora81\rdbms\admin{enter}")

ControlSend($hWnd," "," ","cls{enter}")

Link to comment
Share on other sites

remove the spaces:

Opt("WinTitleMatchMode",4)

Run("cmd", @SystemDir)

WinWait("classname=ConsoleWindowClass"); (C:\Windows\system32")

$hWnd = WinGetHandle("Classname=ConsoleWindowClass"); (C:\windows\system32")

ControlSend($hWnd," "," ","C:\oracle\ora81\rdbms\admin{enter}")

ControlSend($hWnd," "," ","cls{enter}")

this work?

Opt("WinTitleMatchMode",4)
Run("cmd", @SystemDir)

WinWait("classname=ConsoleWindowClass"); (C:\Windows\system32")
$hWnd = WinGetHandle("Classname=ConsoleWindowClass"); (C:\windows\system32")

ControlSend($hWnd,"","","C:\oracle\ora81\rdbms\admin{enter}")
ControlSend($hWnd,"","","cls{enter}")

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Opt("WinTitleMatchMode",4)

Run("cmd", @SystemDir)

WinWait("classname=ConsoleWindowClass")

$hWnd = WinGetHandle("Classname=ConsoleWindowClass")

ControlSend($hWnd,"","","C:\oracle\ora81\rdbms\admin{enter}")

ControlSend($hWnd,"","","cls{enter}")

I took your code and inserted it into a clean file, saved it as an AU3 file. Used Run Script to launch it and it delivers a dos window with a blinking cursor at C:\Windows\system32>

I don't see the where the ControlSend command is working at all.

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