Использование другой программы через командную строку Windows

303
Qwerty

Я знаю, что могу запускать программы из командной строки, но есть ли способ вводить команды после открытия этой программы? Например, если я открою DOSBox из cmd, как мне ввести команду в DOSBox из cmd? Я пытался, но у меня нет решения.

0
Почему бы не ввести команду непосредственно в DosBox? Чего ты здесь пытаешься достичь? Burgi 8 лет назад 1
@ Бурги, На самом деле, я использую команду system () в C ++ для выполнения другого файла C ++ через DOSBox. Вот почему мне нужно использовать командную строку, а затем работать через нее. Qwerty 8 лет назад 0
Почему бы не использовать system () для непосредственного выполнения этой другой программы на C ++? Таким образом, вы можете добавить параметры прямо в вызове. Зачем вам обходить DosBox? Aganju 8 лет назад 1

2 ответа на вопрос

0
A_User

You can only do this by making a third party App, let's call it TheApp, you would type TheApp.exe then the batch command name after it and the program will then store that and repeat it again when you hit enter. It is handling what command you type instead of cmd.exe handling it.

It's sort of like a shell within a shell.

Example Syntax:

TheApp copy "c:\windows\system32\something.ini" "E:\backup_001\2.5.16" 

When you hit enter it will continue to store the copy command but not the paramaters) as part of TheApp, unless you type TheApp SomeDifferentCommand.

I am not aware of any existing programs that can do this, but you know C so you're set to go by the look of it, it would take a little more work to have it work with both internal commands and external commands (which are really just programs in themselves, mainly .com or .exe files)

0
rda

I think you can't specify commands as parameters to DOSBox.exe, but you can specify another executable file that you wish to launch from DOSBox as a command-line parameter to DOSBox.exe:

"C:\Program Files (x86)\DOSBox-0.74\DOSBox.exe" "C:\Other.exe" 

or the above as parameter to cmd.exe:

cmd /c ""C:\Program Files (x86)\DOSBox-0.74\DOSBox.exe" "C:\Other.exe""