ServiioConsole.exe does not return control when called from .bat file

Issue #473 resolved
Former user created an issue

The commands "C:\Program Files (x86)\ServiioX\bin\serviioconsole.exe" and "C:\Program Files (x86)\ServiioX\bin\serviioconsole.exe" -start will start the console if the Server is running but if executed within a batch file will not return control to the bat to allow further processing. The command "C:\Program Files (x86)\ServiioX\bin\serviioconsole.exe" -stop does work correctly and returns control.

The workaround is to use the bat and start the console as a java process but this is not preferred.

Comments (3)

  1. Petr Nejedly repo owner

    This is expected I'd say. The exe runs and is blocking further execution until it exits.

    You'd have to run it in 'background', try using cmd command in the bat or add %* after the .exe, similar to what is in serviio-console.bat (or google how to do it on Windows).

    Mark this as resolved when you succeed.

  2. Former user Account Deleted

    Thanks Zip! The solution is as follows but there is a catch!

    To invoke the console from a windows bat file using the "serviioconsole.exe" one must use the start command in order for the bat to terminate and let the console window run.

    The documented format of that command is START ["WINDOW TITLE"] [OPTIONS] YOURCOMMAND so I used START "C:\Program Files (x86)\Serviio\bin\startconsole.exe" but the console would never start.

    After a lot of searching I found this interesting comment at http://ss64.com/nt/start.html "Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes "" According to the Microsoft documentation, the title is optional, but you may have problems if it is omitted."

    So I tried START "" "C:\Program Files (x86)\Serviio\bin\startconsole.exe" and bingo it worked. W7-64 and perhaps other versions cannot distinguish a "COMMAND" in the absence of a "TITLE" So a command like start notepad will work but start "notepad" will not!

    I'll make another request for a simple resident system tray icon that contains "Start Serviio" and "Start Serviio Console" to eliminate the need for similar desktop start shortcuts.

  3. Log in to comment