How to run more than one cmd command at once? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
A random guy
Posts: 31
Joined: 10 Feb 2017, 19:55

How to run more than one cmd command at once?

22 Oct 2017, 18:35

Im trying to do some ftp automation stuff but i need some help

I can run multiple cmd commands like this

Code: Select all

run, %comspec% /k ipconfig & help
yet this doesnt work

Code: Select all

run, %comspec% /k ftp & open localhost & username & password
what am i doing wrong?
BoBo
Posts: 2519
Joined: 13 May 2014, 17:15

Re: How to run more than one cmd command at once?  Topic is solved

22 Oct 2017, 23:45

Command A & Command B

Execute Command A, then execute Command B (no evaluation of anything)

Command A | Command B

Execute Command A, and redirect all its output into the input of Command B

Command A && Command B

Execute Command A, evaluate the errorlevel after running and if the exit code (errorlevel) is 0, only then execute Command B

Command A || Command B

Execute Command A, evaluate the exit code of this command and if it's anything but 0, only then execute Command B
You might get forced using ftp's "file"-option ... https://ss64.com/nt/ftp.html
User avatar
mviens
Posts: 43
Joined: 08 Jan 2014, 19:04

Re: How to run more than one cmd command at once?

27 Oct 2017, 18:37

The reason it will not work is because "ftp" is an application that is running which expects user input. If "ftp" were to exit, then it would accept the next command of "open localhost". That however, would make no sense since it is not a command.

What you want to do is create input that can be piped into the "ftp" command. That has nothing to do with AHK though. Try looking here: https://technet.microsoft.com/en-us/lib ... 90982.aspx
Mike V.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Chunjee, Google [Bot], jgcampbell300, millansoft, yessir3 and 257 guests