Hello there!
I want to execute some comands in cmd, BUT, my issue is:
there is a chunk of code i can execute right away, that never changes.
i start ftp, and log in/navigate to folder.
after that, i want to copy files depending on some logic.
i would like to get a handle to CMD, so i can make each operation separatedly, inside the loop with the logic, and just keep sending comands to the CMD.
i could make a login on the ftp for each batch of files to send, but it would be too much work and i dont know if the server would handle it ok.
i could first start cmd and then use control send to the window, but i dont know how reliable it is.
if it is indeed realiable the issue is finished. else, i would like to use something like COM, or like the "run CMD with a file with all instructions as input", but without opening a new CMD prompt every time.
What i want is this: (pseudo code)
; - - -- - - - code starts here
run ftp
login and password
cd folder1 ;open folder to which ill send files inside ftp server
for each file on folder "pictures"
{
if (picture has name "party")
{
send picture to folder 1 ; --> here, i want to send a "ftp send picture" comand for each picture, on the same cmd window.
}
}
; - - - - - - - - -finish code
thanks in advance!
Way to control CMD in reliable way (like using COM) Topic is solved
Re: Way to control CMD in reliable way (like using COM)
Look at this thread it was really helpful for me. https://autohotkey.com/board/topic/100322-run-a-program-get-output-as-a-string/
You are going to want to use shell.exec to create the cmd, StdIn.WriteLine() to give input, and StdOut.readall() to read its response.
You are going to want to use shell.exec to create the cmd, StdIn.WriteLine() to give input, and StdOut.readall() to read its response.
Re: Way to control CMD in reliable way (like using COM) Topic is solved
Thanks for the reply it helped!
Actually, i didnt find a way to do exactly what i intended, but found another estable way.
Instead of running the comands on the fly, i did file appends to create a .txt comand list. after that, it can be executed.
Thanks!
Actually, i didnt find a way to do exactly what i intended, but found another estable way.
Instead of running the comands on the fly, i did file appends to create a .txt comand list. after that, it can be executed.
Thanks!
Who is online
Users browsing this forum: dnus, garry, JoeWinograd, yabab33299 and 147 guests