I need an explanation of the "system command" syntax for the parameter of the exec () method.

Runtime.getRuntime().exec("cmd /c start cmd.exe"); 

What, for example, in this case means the meta symbol \ c and the start parameter. It is clear that it runs the command line, but why not just cmd.exe ? After all, some processes run just along the way. Where can I find a complete syntax guide? Oracle documentation is silent on this ...

Thank you in advance)

    1 answer 1

    These are the windows console commands (click Start-execute-enter "cmd"), which are started by the virtual java machine via Runtime.getRuntime (). Exec (...).

     Runtime.getRuntime().exec("cmd /c start cmd.exe"); 

    With this combination of commands, a separate cmd window is launched.

    cmd - command interpreter

    start - the command to start something in a separate window

     C:\Windows\System32>cmd /? Запуск Π½ΠΎΠ²ΠΎΠΉ ΠΊΠΎΠΏΠΈΠΈ ΠΈΠ½Ρ‚Π΅Ρ€ΠΏΡ€Π΅Ρ‚Π°Ρ‚ΠΎΡ€Π° ΠΊΠΎΠΌΠ°Π½Π΄ Windows. CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] [[/S] [/C | /K] строка] /C Π’Ρ‹ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΡƒΠΊΠ°Π·Π°Π½Π½ΠΎΠΉ ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹ (строки) с ΠΏΠΎΡΠ»Π΅Π΄ΡƒΡŽΡ‰ΠΈΠΌ Π·Π°Π²Π΅Ρ€ΡˆΠ΅Π½ΠΈΠ΅ΠΌ. 

    In fact, we do this:

    1. run interpreter cmd

    2. run the start command in it, which will open a separate window cmd

    3. exit cmd

    PS If it were supposed that the program in java should be executed not in Windows but for example in Linux, then the commands would be different.

    • Thank you very much for the answer. Still interested in the question: is it possible to specify the launch parameter cmd.exe in the current example, for example, open in minimized mode? - Dev0ps
    • one
      Of course, the start command has the MIN key. cmd /c start /MIN cmd.exe - virex-84
    • Thank you so much) - Dev0ps