Je peux comprendre cmd
mais pas cmd /c
. J'essayais d'invoquer un programme Java à partir du courant pour lequel j'utilise Runtime.getRuntime().exec("cmd /C java helloworld");
Il se pose mon doute.Que signifie cmd/C?
145
A
Répondre
85
/C
Exécute la commande spécifiée par la chaîne, puis se termine.
Vous pouvez obtenir tous les commutateurs de ligne de commande cmd en tapant cmd /?
.
17
CMD.exe
Start a new CMD shell
Syntax
CMD [charset] [options] [My_Command]
Options
**/C Carries out My_Command and then
terminates**
De l'aide.
184
La partie qui devrait vous intéresser est la partie /?
, ce qui devrait résoudre la plupart des autres questions que vous avez avec l'outil.
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\>cmd /? Starts a new instance of the Windows XP command interpreter CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] [[/S] [/C | /K] string] /C Carries out the command specified by string and then terminates /K Carries out the command specified by string but remains /S Modifies the treatment of string after /C or /K (see below) /Q Turns echo off /D Disable execution of AutoRun commands from registry (see below) /A Causes the output of internal commands to a pipe or file to be ANSI /U Causes the output of internal commands to a pipe or file to be Unicode /T:fg Sets the foreground/background colors (see COLOR /? for more info) /E:ON Enable command extensions (see below) /E:OFF Disable command extensions (see below) /F:ON Enable file and directory name completion characters (see below) /F:OFF Disable file and directory name completion characters (see below) /V:ON Enable delayed environment variable expansion using ! as the delimiter. For example, /V:ON would allow !var! to expand the variable var at execution time. The var syntax expands variables at input time, which is quite a different thing when inside of a FOR loop. /V:OFF Disable delayed environment expansion.
il y a aussi une commande « pause » la fenêtre cmd après la sortie: « cmd/c nom_fichier & PAUSE » il est peu différent de cmd/k – JerryGoyal
si une commande donnée est une sorte d'un serveur qui démarre, il est propre boucle? Devrions-nous utiliser/C ou/K? –
Lors de l'exécution de la commande en C# via 'Process', l'utilisation de/C est obligatoire dans Windows 7 ou Windows Server 2008 R2? –