Home > Computer/ Tech Related, Useless Update > Geeky Scripting Shit

Geeky Scripting Shit

December 18th, 2013 2:02am Leave a comment

I am blogging this for my own good because I always fucking forget the difference between this shit and lost the link.  It was explained super well on StackOverflow. Sorry if you don’t give a fuck about it or it’s not funny. Whatever dudes.

A windows batch file (called.bat or called.cmd) can be called from another batch file (caller.bat or caller.cmd) or interactive cmd.exe prompt in several ways:

  1. direct call: called.bat
  2. using call command: call called.bat
  3. using cmd command: cmd /c called.bat
  4. using start command: start called.bat

Answers:

  1. the batch file will be executed by the current cmd.exe instance (or a new cmd.exe instance if, for instance, double-clicked in Explorer).
  2. same as #1, only has an effect when used inside a batch/cmd file. In a batch file, without ‘call’, the parent batch file ends and control passes to the called batch file; with ‘call’ runs the child batch file, and the parent batch file continues with statements following call.
  3. runs the batch file in a new cmd.exe instance.
  4. start will run the batch file in a new cmd.exe instance in a new window, and the caller will not wait for completion.

Source: http://stackoverflow.com/questions/2607856/several-ways-to-call-a-windows-batch-file-from-another-one-or-from-prompt-which

  1. No comments yet.
You must be logged in to post a comment.