1

Seems like start has an issue:

start /min blender -b scene.blend -P script.py && convert *.png -append out.png

This will run both blender and convert at the same time. Is there a way to do the following?

start /min (blender -b scene.blend -P script.py && convert *.png -append out.png)

Not sure if helpful but addition context to my current batch file runs a few instances of blender in parallel so the only reason I've used start is to run multiple instances of blender at once:

(
start blender ... && convert ...
start blender ... && convert ...
start blender ... && convert ...
start blender ... && convert ...
start blender ... && convert ...
) | pause
(
start blender ... && convert ...
start blender ... && convert ...
start blender ... && convert ...
start blender ... && convert ...
start blender ... && convert ...
) | pause
Helen Che
  • 1,951
  • 5
  • 29
  • 41
  • 2
    Please read my answer on [Single line with multiple commands using Windows batch file](https://stackoverflow.com/a/25344009/3074564). The operator `&&` and everything right of it is interpreted by `cmd.exe` as additional command to run after execution of `start` was successful. In other words once `start` finished starting `blender` successfully, the Windows command processor `cmd.exe` continues and executes now itself `convert` while `blender` is running as separate process parallel to `cmd.exe` processing the batch file. Open a command prompt, run `start /?` and read the output help. – Mofi Apr 16 '21 at 06:43
  • 1
    Please note that `start` starts `blender` (whatever this is) and not `cmd.exe` which is required to interpret `&&`. You could use `start "Blend and convert" /min %ComSpec% /D /C "blender -b scene.blend -P script.py && convert *.png -append out.png"` to start another command process with a minimized console window with title `Blend and convert` which executes first `blender` and when this executable/script finished with exit code 0 runs next `convert` and finally closes itself. The command process processing the batch file immediately continues processing it. Is that really necessary? – Mofi Apr 16 '21 at 06:55

2 Answers2

1
start /wait /b blender -b scene.blend -P script.py && start /wait /b convert *.png -append out.png
tadman
  • 208,517
  • 23
  • 234
  • 262
user15611379
  • 56
  • 1
  • 3
1

As @Mofi explained, the && is not executed inside the new cmd window, it's executed directly after the start started blender.
But with escaping them with ^&^& it works as expected.

start /min blender -b scene.blend -P script.py ^&^& convert *.png -append out.png

You could also use the /B option to stay in the same cmd window, to avoid the opening of many new windows.

Sometimes it's also a good idea to start a secondary batch file instead of building a complex single line command.

start /B cmd /c execute.bat
jeb
  • 78,592
  • 17
  • 171
  • 225