Java executes windows cmd command, and java executes windowscmd

Source: Internet
Author: User
Tags nslookup

Java executes windows cmd command, and java executes windowscmd

// Obtain the runtime

Runtime rt = Runtime. getRuntime ();

// Obtain the process

Process p = rt.exe c (String [] cmdarray); or Process p = rt.exe c (String cmd );

If p is not empty, clear it.

If (null! = P) {destory

P. destory ();

P = null;

}

For example:

Runtime rt = Runtime.getRuntime();        Process p = rt.exec("cmd.exe /c shutdown -a");        System.out.println(p.toString());

Cmd/c dir: Close the command window after executing the dir command.

Cmd/k dir does not close the command window after executing the dir command.

Cmd/c start dir opens a new window and executes the dir command. The original window is closed.

Cmd/k start dir will open a new window and execute the dir command. The original window will not close.

You can use cmd /? View help information.

★CMD command★
1. gpedit. msc ----- Group Policy
2. sndrec32 ------- Recorder
3. Nslookup ------- IP address Detector
4. explorer ------- open the Resource Manager
5. logoff --------- logout command
6. tsshutdn ------- 60 seconds countdown shutdown command
7. lusrmgr. msc ---- local users and groups
8. services. msc --- local service settings
9. oobe/msobe/a ---- check whether XP is activated
10. notepad -------- open notepad
11. cleanmgr ------- garbage collection
12. net start messenger ---- start the messenger Service
13. compmgmt. msc --- Computer Management
14. net stop messenger ----- stop the messenger Service
15. conf ----------- Start netmeeting
16. dvdplay -------- DVD player
17. charmap -------- start the character ing table
18. diskmgmt. msc --- disk Management Utility
19. calc ----------- start Calculator
20. dfrg. msc ------- disk fragment Program
21. chkdsk.exe ----- Chkdsk disk check
22. devmgmt. msc --- Device Manager
23. regsvr32/u *. dll ---- stop dll file running
24. drwtsn32 ------ system doctor
25. rononce-p ---- shutdown within 15 seconds
26. dxdiag --------- check DirectX Information
27. regedt32 ------- Registry Editor
28. Msconfig.exe --- System Configuration Utility
29. rsop. msc ------- group policy result set
30. mem.exe -------- Display memory usage
31. regedit.exe ---- Registry
32. winchat -------- XP built-in LAN chat
33. progman -------- Program Manager
34. winmsd --------- system information
35. perfmon. msc ---- computer performance monitoring program
2. 36. winver --------- check the Windows version
37. sfc/scannow ----- scan for errors and restore
38. taskmgr ----- Task Manager (2000/xp/2003
39. winver --------- check the Windows version
40. wmimgmt. msc ---- open windows management architecture (WMI)
41. wupdmgr -------- windows Update Program
42. wscript -------- windows Script Host settings
43. write ---------- WordPad
44. winmsd --------- system information
45. wiaacmgr ------- scanner and camera wizard
46. winchat -------- XP built-in LAN chat
47. mem.exe -------- Display memory usage
48. Msconfig.exe --- System Configuration Utility
49. mplayer2 ------- simple widnows media player
50. mspaint -------- graphic Board
51. mstsc ---------- Remote Desktop Connection
52. mplayer2 ------- Media Player
53. magnify -------- magnifier Utility
54. mmc ------------ open the Console
55. mobsync -------- synchronization command
56. dxdiag --------- check DirectX Information
57. drwtsn32 ------ system doctor
58. devmgmt. msc --- Device Manager
59. dfrg. msc ------- disk fragment Program
60. diskmgmt. msc --- disk Management Utility
61. dcomcnfg ------- open the system component service
62. ddeshare ------- enable DDE sharing settings
63. dvdplay -------- DVD player
64. net stop messenger ----- stop the messenger Service
65. net start messenger ---- start the messenger Service
66. notepad -------- open notepad
67. nslookup ------- network management tool wizard
68. ntbackup ------- system backup and Restoration
69. narrator ------- "narrator" on the screen"
70. ntmsmgr. msc ---- mobile Storage Manager
71. ntmsoprq. msc --- mobile storage administrator Operation Request
72. netstat-an ---- (TC) command Check interface
73. syncapp -------- create a briefcase
74. sysedit -------- System Configuration Editor
75. sigverif ------- file signature verification program
76. sndrec32 ------- Recorder
77. shrpubw -------- create a shared folder
78. secpol. msc ----- Local Security Policy
79. syskey --------- system encryption. Once encrypted, the password cannot be unlocked. This protects windows XP system dual passwords.
80. services. msc --- local service settings
81. Sndvol32 ------- Volume Control Program
82. sfc.exe -------- System File Checker
83. sfc/scannow --- windows File Protection
84. tsshutdn ------- 60 seconds countdown shutdown command
3. 84. tsshutdn ------- 60 seconds countdown shutdown command
85. tourstart ------ xp introduction (roaming xp program displayed after installation)
86. taskmgr -------- Task Manager
87. eventvwr ------- Event Viewer
88. eudcedit ------- Word Creation Program
89. explorer ------- open the Resource Manager
90. packager ------- object package
91. perfmon. msc ---- computer performance monitoring program
92. progman -------- Program Manager
93. regedit.exe ---- Registry
94. rsop. msc ------- group policy result set
95. regedt32 ------- Registry Editor
96. rononce-p ---- shutdown within 15 seconds
97. regsvr32/u *. dll ---- stop dll file running
98. regsvr32/u zipfldr. dll ------ cancel ZIP support
99. cmd.exe -------- CMD Command Prompt
100. chkdsk.exe ----- Chkdsk disk check
101. certmgr. msc ---- Certificate Management Utility
102. calc ----------- start Calculator
103. charmap -------- start the character ing table
104. cliconfg ------- SQL SERVER Client Network Utility
105. Clipbrd -------- clipboard Viewer
106. conf ----------- Start netmeeting
107. compmgmt. msc --- Computer Management
108. cleanmgr ------- garbage collection
109. ciadv. msc ------ Indexing Service Program
110. osk ------------ open the Screen Keyboard
111. odbcad32 ------- ODBC data source Manager
112. oobe/msobe/a ---- check whether XP is activated
113. lusrmgr. msc ---- local users and groups
114. logoff --------- logout command
115. iexpress ------- Trojan bundle tool, which comes with the System
116. Nslookup ------- IP address Detector
117. fsmgmt. msc ----- Shared Folder Manager
118. utilman -------- auxiliary tool Manager
119. gpedit. msc ----- Group Policy
120. explorer ------- open the Resource Manager
Javac actually executes the command but does not output the execution result because you do not output the execution result.
If you execute runtime.getruntime.exe c ("cmd ");
No results
Because it is not executed in a java program but on the Operating System
In this example, runtime.getruntime.exe c ("cmd/c start javac ");
You can see a command line window.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.