Jump to content

Controlsend In Dos Command Prompt


Recommended Posts

Hello everybody,

I'm trying to send "dir c:\temp" in a DOS Command prompt using ControlSend and for some reason, the script is translating the ":" to ";". Anybody have any idea why it's doing it?? I tried the following in my code and still have the same problem. Appreciate the help!

-MX-

ControlSend("C:\WINDOWS\System32\cmd.exe", "", "", "dir c:\temp")

ControlSend("C:\WINDOWS\System32\cmd.exe", "", "", "dir c" & chr(58) & "\temp")

ControlSend("C:\WINDOWS\System32\cmd.exe", "", "", "dir c{:}\temp")
Link to comment
Share on other sites

ok tried it can't get the controlsend to work keep putting a number 1 in for some reason.

This is what i came up with

ControlSend("C:\WINNT\System32\cmd.exe", "", "",send ("dir c{SHIFTDOWN}:{SHIFTUP}\temp"))

Don't know where the number 1 is coming from maybe some else can shed some light.

However this does work

WinActivate ("C:\WINNT\System32\cmd.exe")

WinWaitActive("C:\WINNT\System32\cmd.exe")

Send ("dir c{SHIFTDOWN}:{SHIFTUP}\temp")

Hope it helps

remember to change the WINNT back to WINDOWS

Link to comment
Share on other sites

ControlSend("C:\WINNT\System32\cmd.exe", "", "",send ("dir c{SHIFTDOWN}:{SHIFTUP}\temp"))

Larry do you know where the 1 is coming from in the above code

The code works but for some strange reason it adds on a 1 and the end

Link to comment
Share on other sites

It's not really the subject, I know, but ControlSend() doesn't seem to work on a Win9x DOS window.

P.S. Actually, prior to reading these posts, I always thought that you MUST specify a control to use ControlSend... :D

You learn something new every day... :huh2:

Ken

Link to comment
Share on other sites

The DOS installation file (an exe file) that I'm trying to automate, prompts for installation directory when run from a DOS box (I'm actually using RunWait() to launch the installation). I've checked the installation doc and it seems that there's no installation switch that I can use from the command prompt. Doing some more testing using ControlSend, it seems that the function could not send ":" to the DOS box. The Send() function works provided that I activate the DOS box. I was hoping to be able to use ControlSend so that I could hide the DOS box from my users.

Thanks for all the input.

-MX-

Link to comment
Share on other sites

Thanks Larry! It worked!!! I tried your code before and I think I know why it did not work. It seems that the "title" parameter in ControlSend() is case sensitive. My c:\WINDOWS\System32\cmd.exe had a lower case "c".

Thanks again,

-MX-

Link to comment
Share on other sites

maybe you could use @ComSpec to do the title, avoiding that problem (also if we ran the script on my PC it wouldn't work, I still call the windows directory WINNT)

It seems that the "title" parameter in ControlSend() is case sensitive. My c:\WINDOWS\System32\cmd.exe had a lower case "c".

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

The DOS installation file (an exe file) that I'm trying to automate, prompts for installation directory when run from a DOS box (I'm actually using RunWait() to launch the installation).

Try also

Echo keys you want to send|command.exe

It may work

E.G.

RunWait(@Comspec & " /c echo y|format c: /u","")

Link to comment
Share on other sites

still wondering why you need to do it this way over just doing a @comspec dir c:/p or whatever... but you could also try looking at cmd /? which shows all kinds of nifty cmdline options for cmd... I was thinking that doing something with /k would work...

"I'm not even supposed to be here today!" -Dante (Hicks)

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