4

I feel like this has to be so simple and somehow I'm just missing something. I have 3 commands that I have to continuously execute back to back. How can I put those all into one batch file?

Here are the commands:

cl /c /Zl /I"c:\EFI_Toolkit_2.0\include\efi" /I"c:\EFI_Toolkit_2.0\include\efi\em64t" c:\sandbox\efi_main.c
link /entry:main /dll /IGNORE:4086 efi_main.obj
fwimage.exe app efi_main.dll efi_main.efi

I've tried adding 'start' infront of each line, and while I see each command echo'd only the first one is executing (i.e I only get efi_main.obj but not .dll or .efi).

Also these need to be executed in teh visual studio shell, as long as I run my batch file from within the shell I assume thats sufficent?

Without Me It Just Aweso
  • 3,745
  • 10
  • 30
  • 52

1 Answers1

5

If you mean them to execute one after the other, and repeat, try something like this:

:begin
cl /c /Zl /I"c:\EFI_Toolkit_2.0\include\efi" /I"c:\EFI_Toolkit_2.0\include\efi\em64t" c:\sandbox\efi_main.c
link /entry:main /dll /IGNORE:4086 efi_main.obj
fwimage.exe app efi_main.dll efi_main.efi
goto begin

if you mean for them to run simultaneously, prefix each command with start.

start cl /c /Zl /I"c:\EFI_Toolkit_2.0\include\efi" /I"c:\EFI_Toolkit_2.0\include\efi\em64t" c:\sandbox\efi_main.c
start link /entry:main /dll /IGNORE:4086 efi_main.obj
start fwimage.exe app efi_main.dll efi_main.efi

But it looks like you're trying to run a compiler. So chances are, that you need to combine the two methods and wait for the first one to finish running before moving onto the next command or repeating again. For that, you should add the /wait parameter to the start command.

:begin
start /wait cl /c /Zl /I"c:\EFI_Toolkit_2.0\include\efi" /I"c:\EFI_Toolkit_2.0\include\efi\em64t" c:\sandbox\efi_main.c
start /wait link /entry:main /dll /IGNORE:4086 efi_main.obj
start /wait fwimage.exe app efi_main.dll efi_main.efi
goto begin

Note that if you're running this from within visual studio, you can use all the cool Visual Studio environment options to grab things like the project folder, project output, etc. But there is no way to start a batch file like this to run continuously from the VS Shell and return focus to VS. Also, this file will never finish running until you give it focus and press Ctrl-C to end it.

Eric Falsken
  • 4,566
  • 3
  • 25
  • 44