exec cmd.exe tcl

tcl

Solution

Let's break it down:

exec cmd.exe /c start /wait $buildLoc\\setup.exe /extract_all:C:/setup
#^^^

The exec command starts a subprocess.

exec cmd.exe /c start /wait $buildLoc\\setup.exe /extract_all:C:/setup
#    ^^^^^^^^^^

cmd.exe is a windows "batch" shell, The `/c` flag asks it to run its arguments as a command.

exec cmd.exe /c start /wait $buildLoc\\setup.exe /extract_all:C:/setup
#               ^^^^^^^^^^^

The start command, built into `cmd.exe`, is also a way to get another program to start. The `/wait` flag tells it to wait until the started program ends.

exec cmd.exe /c start /wait $buildLoc\\setup.exe /extract_all:C:/setup
#                           ^^^^^^^^^

A regular TCL variable; it will be expanded inside TCL.

The rest is whatever the setup.exe program does (which is who knows what...)

Without knowing a little more about the program being run here (see below) it's hard to say exactly why the intermediate `exec.cmd /c start /wait` was needed; I'd guess that the cmd.exe is to load all of the system's default environment (instead of using the environment inherited from the tcl program) and the `start` is to open a terminal window so the output of the setup.exe program is shown to the user.

Problem

I have been looking on information about exec cmd.exe, but I cannot find anything helpful. Can anyone explain to me the following code: ``` exec cmd.exe /c start /wait $buildLoc\\setup.exe /extract_all:C:/setup ```

Original source