Search code examples
batch-filedotnet-cli

Open dotnet applications in separate window using bat file


I have bat file which contains

dotnet ...\something.dll
dotnet ...\stuff.dll arguments
dotnet ...\others.dll

What I want is when run bat file, open three separate windows with different application.

In first window, executes something.dll, other window stuff.dll, etc

How to achieve in bat file command?


Solution

  • You can use the start command:

    start dotnet ...\something.dll
    start dotnet ...\stuff.dll arguments
    start dotnet ...\others.dll
    

    If you want to wait until each process finished add a /wait flag:

    start /wait dotnet ...\something.dll
    start /wait dotnet ...\stuff.dll arguments
    start /wait dotnet ...\others.dll
    

    Or to be sure a new window will be opened start a new cmd window with:

    start cmd /c dotnet ...\something.dll
    start cmd /c dotnet ...\stuff.dll arguments
    start cmd /c dotnet ...\others.dll
    

    /c option in cmd command carries out the command specified by string and then terminates.

    Replace it with /k (Carries out the command specified by string and remains).

    An interesting reference: Run a batch file in a new window from batch?