关于命令行:cmd / C是什么意思?

What does cmd /C mean?

我可以理解cmd,但不能理解cmd /c。 我试图从当前使用Runtime.getRuntime().exec("cmd /C java helloworld");的Java程序中调用Java程序。这引起了我的怀疑。


您应该感兴趣的部分是/?部分,该部分应解决该工具存在的其他大多数问题。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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.


/C执行由字符串指定的命令,然后终止。

您可以通过键入cmd /?获得所有cmd命令行开关。


1
2
3
4
5
6
7
8
9
10
11
CMD.exe

Start a new CMD shell

Syntax
      CMD [charset] [options] [My_Command]

Options      

**/C     Carries out My_Command and then
terminates**

从帮助。