1

I tried the command call, but it runs another instance of the CMD shell attached to a new console. Is there a way to execute the commands from the other file in the current CMD shell?

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
Cibin
  • 590
  • 1
  • 7
  • 13
  • Are you **really** using MS-DOS or are you talking about the Windows command line (which is something very different) –  Feb 02 '18 at 09:33
  • The tags "windows" and "dos" seem appropriate to your question, but how is it related to "bash"? – Abra Feb 02 '18 at 09:33
  • @Abra: the command line in Windows has **nothing** to do with "DOS" or "MS-DOS" –  Feb 02 '18 at 09:34
  • `call` will **not** start a new cmd window –  Feb 02 '18 at 09:35
  • @a_horse_with_no_name, I was being a bit lenient. I believe one could easily assume Windows and DOS are related, but knowing why bash is also included may help understand the question asked, which I think you'll agree, is not completely clear. – Abra Feb 02 '18 at 09:37
  • @Abra: Windows and "DOS" have not been "related" since Windows 2000 –  Feb 02 '18 at 09:38
  • @a_horse_with_no_name a quick Internet search gives me the impression that many people still refer to the command prompt as the DOS prompt, so even though they are not related, people use both terms to refer to the former. Hence my request for clarification. – Abra Feb 02 '18 at 09:42
  • 1
    I believe this a duplicate question and was answered here: https://stackoverflow.com/questions/10402379/is-there-an-equivalent-source-command-in-dos-command-prompt-as-in-bash-or-tcsh – AnythingIsFine Feb 02 '18 at 11:01
  • I edited out two common mistakes. The CMD shell is a Windows console application, not a DOS application. (DOS used a similar but simpler shell named COMMAND.COM.) It is also a source of confusion to call it a "cmd window". The window is a console -- an OS provided resource that CMD allocates or inherits by default; however, it can run without one. – Eryk Sun Feb 03 '18 at 21:34
  • If you're going to use the `bash` tag, that implies that people who are experts in bash can be expected to answer your question. That's not the case here, so that tag shouldn't be present. – Charles Duffy Feb 03 '18 at 21:36
  • Also, please provide a concrete example. In general, from the command line you can 'source' another batch script by simply running it. In a batch script itself, use `call` to allow returning to the current script. Neither of these starts a new instance of CMD unless you're explicitly using `cmd /c` or `start`. Since you say a new console is created, you're probably using `start`, either directly in the current script or indirectly in the other script. – Eryk Sun Feb 03 '18 at 21:54

0 Answers0