0

I have the following .bat code:

cd "C:\Program Files\Blender Foundation\Blender"
blender.exe
image.jpeg

I am trying to make blender open when I start the batch file, then immediately after, show image called "image.jpeg"

When I do this, it starts blender in the current cmd window, and then holds the program up until blender is closed.

Thanks!

Gerhard
  • 22,678
  • 7
  • 27
  • 43
Jack Crane
  • 61
  • 5
  • 2
    Possible duplicate of [How can I run a program from a batch file without leaving the console open after the program starts?](https://stackoverflow.com/questions/324539/how-can-i-run-a-program-from-a-batch-file-without-leaving-the-console-open-after) or https://stackoverflow.com/questions/2451861/how-to-not-wait-for-a-process-to-complete-in-batch-script or https://stackoverflow.com/questions/2937569/how-to-start-an-application-without-waiting-in-a-batch-file or many more – underscore_d Nov 15 '19 at 12:58
  • You may use `start` command: `start blender.exe`, probably you may be interested in `/B` key. – Nick Nov 15 '19 at 13:09
  • Does this answer your question? [How to NOT wait for a process to complete in batch script?](https://stackoverflow.com/questions/2451861/how-to-not-wait-for-a-process-to-complete-in-batch-script) – Jeff Zeitlin Nov 15 '19 at 13:24
  • 1
    @underscore_d Though I agree that `start` is the solution here, I do not really agree with the solutions of the linked answers themselves. the way `start` is used in those examples may work, but they are incorrect. `start` sees the first quoted object as the title, so `start "c:\program files\someprog.exe"` might end up in certain cases not working. The correct method is `start "" "C:\Program files\someprog.exe"` – Gerhard Nov 15 '19 at 14:21
  • @GerhardBarnard One of the questions I linked is very careful to point that out in its top answer, and the others end up mentioning it somewhere. – underscore_d Nov 15 '19 at 14:26
  • Are you wanting to open `image.jpeg` in `blender.exe`? or are you wanting to open `blender.exe` and also open the default application assigned to `.jpeg` files with `image.jpeg` showing. Also your code suggests that `image.jpeg` is located inside the directory `C:\Program Files\Blender Foundation\Blender`. Please provide us with more information. – Compo Nov 15 '19 at 19:24

1 Answers1

0

Yes. start does that for you This assumes image.jpg is in the same directory as blender:

cd /d "C:\Program Files\Blender Foundation\Blender"
start "" "blender.exe"
image.jpeg

same with this:

pushd "C:\Program Files\Blender Foundation\Blender"
start "" "blender.exe"
image.jpeg
popd

where this assumes image.jpeg is in the folder where the batch file started from:

start "" "C:\Program Files\Blender Foundation\Blender\Blender.exe"
image.jpeg
Gerhard
  • 22,678
  • 7
  • 27
  • 43