midiaxe Posted May 5, 2004 Share Posted May 5, 2004 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 More sharing options...
vickerps Posted May 5, 2004 Share Posted May 5, 2004 the : symbol is done via holding shift down. Your script doesn't do this. putting in Send Send ("{SHIFTDOWN}{;}{SHIFTUP}") Just finishing of my job and then ill have a look myself Link to comment Share on other sites More sharing options...
vickerps Posted May 5, 2004 Share Posted May 5, 2004 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 More sharing options...
vickerps Posted May 5, 2004 Share Posted May 5, 2004 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 codeThe code works but for some strange reason it adds on a 1 and the end Link to comment Share on other sites More sharing options...
lte5000 Posted May 5, 2004 Share Posted May 5, 2004 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... You learn something new every day... Ken Link to comment Share on other sites More sharing options...
ezzetabi Posted May 5, 2004 Share Posted May 5, 2004 Why use controlsend when you can use RunWait? Link to comment Share on other sites More sharing options...
midiaxe Posted May 5, 2004 Author Share Posted May 5, 2004 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 More sharing options...
midiaxe Posted May 6, 2004 Author Share Posted May 6, 2004 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 More sharing options...
emmanuel Posted May 6, 2004 Share Posted May 6, 2004 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 More sharing options...
ezzetabi Posted May 6, 2004 Share Posted May 6, 2004 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 alsoEcho keys you want to send|command.exeIt may workE.G.RunWait(@Comspec & " /c echo y|format c: /u","") Link to comment Share on other sites More sharing options...
emmanuel Posted May 6, 2004 Share Posted May 6, 2004 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now