I'm trying to make a script that will open the command prompt and input some text to run a command. I run into an issue that certain characters that get sent as different characters. Here's an example.
run, cmd.exe /k cd <location>
Sleep 500
Send :/.",
Result:
<location>>^:/@?
The characters :/.", are sent as ^:/@? to the command prompt, respectively.
If I get rid of the sleep command it works fine but I need it. Otherwise the text is sent before the command prompt is in focus, sending the input to whatever window was previously in focus
How can I get it to sleep for half a second and then properly send those characters? I need those specific characters in some of my commands.
Sending text to command prompt
Re: Sending text to command prompt
Not sure why you'd need to cd to a dir when AHk offers many built in approaches for running binaries etc but..
trysee: Run > OutputVarPID & WinWait in the help file for more info
htms
try
Code: Select all
SomePath = *THE FOLDER*
run, cmd.exe /k cd "%SomePath%",,, cmdPID
WinWait, ahk_pid %cmdPID%
Send :/.",
htms
Re: Sending text to command prompt
This doesn't seem to solve the main issue.
I use the command "Send :/."," but this is what appears in cmd. http://puu.sh/q9Wam/70eb5a8c62.png
I use the command "Send :/."," but this is what appears in cmd. http://puu.sh/q9Wam/70eb5a8c62.png
Re: Sending text to command prompt
works for me. try SendInput :/."," or SendEvent :/.","
either one also work for me
either one also work for me
Re: Sending text to command prompt
Sending text to a cmd window can be tricky at times and can behave irregular in my experience. You can also try https://autohotkey.com/board/topic/25446-consolesend/ which has given me some good results in the past.