Sequence of instructions in cmd shell doesn't work

I have a sequence of commands in a single step like this:

- name: Build
  working-directory: .\racket\src\worksp
  shell: cmd
  run: |
    msvcprep.bat x86_amd64
    build.bat
    ..\..\racket.exe csbuild.rkt
    ..\..\raco.exe pkg install racket-lib

However, this doesn’t seem to run properly since only the first step executes. All the others are ignored and the next step is executed.

How can I get this to execute all the commands inside the run section?

Thank you for reporting this issue. This is an expected behavior.

In ancient DOS versions it was not possible to recursively execute batch files. Then the call command was introduced that called another cmd shell to execute the batch file and returned execution back to the calling cmd shell when finished.

You can use call command before bat file name to

call msvcprep.bat x86_amd64
call build.bat
1 Like