I would like to write a batch/cmd script to pass arguments to another command-line program.
However, I'd like to display the output of that program in the batch file, and be able to interact with the program normally.
Effectively, the batch file becomes a transparent way to access the program.
How do I do this?
Answer
I couldn't understand the question very clearly but call
is the command that comes to my mind. It is an internal command being a feature of cmd.exe
as external commands exist as separate executable files, usually in %SystemRoot%\System32
folder.
call
command executes other batch files (with .bat
extension) within the calling script and may pass arguments to that external executable file assigned as to its parameters.
Moreover, call command may call
for label
(defined as :MyLabel
inside the batch file, and otherwisely intended and working with GOTO
command as points or sections in a batch file to switch the execution to, which is an old and might also be a wrong feature) within the script itself without referring to any external batch file.
The command is well documented in an SS64 page, and it's main difference from just calling the other script or executable file without any using any command, say as MyScript.bat
or MyExecutable.exe
is that it doesn't leave and exit the current script when calling or upon the external script's finishing, keeping it in the current session, and comes back to and continues executing the calling script's following lines, where the call is originated from.
No comments:
Post a Comment