Java runtime.getruntime (). EXEC (COMMANDSTR) can invoke the Execute CMD command.
cmd/c dir closes 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 will open a new window and execute the dir instruction, the original window will be closed.
cmd/k start dir will open a new window and execute the dir instruction, the original window will not be closed.
You can use cmd/? To view help information.
★cmd Command ★
1. Gpedit.msc-----Group Policy
2. Sndrec32-------Recorder
3. Nslookup-------IP Address detector
4. Explorer-------Open Resource Manager
5. Logoff---------Logout command
6. Tsshutdn-------60 seconds Countdown shutdown command
7. Lusrmgr.msc----Native users and Groups
8. Services.msc---Local Service settings
9. oobe/msoobe/a----Check if XP is active
Notepad--------Open Notepad
cleanmgr-------Waste finishing
start Messenger Service----. Net start Messenger
compmgmt.msc---Computer Management
. net stop Messenger-----Stop messenger Service
conf-----------start NetMeeting
dvdplay--------DVD player
Charmap--------Start character mapping table
diskmgmt.msc---Disk Management utility
Calc-----------Start-Up calculator
dfrg.msc-------Disk Defragmenter
Chkdsk.exe-----CHKDSK disk Check
devmgmt.msc---Device Manager
regsvr32/u *.dll----Stop DLL file run
drwtsn32------System Doctor
rononce-p----15-second shutdown
dxdiag---------checking DirectX information
regedt32-------Registry Editor
Msconfig.exe---System Configuration Utility
rsop.msc.-------Group Policy result set
mem.exe--------Show Memory usage
regedit.exe----Registration Form
winchat--------XP comes with LAN chat
progman--------Program Manager
winmsd---------System Information
perfmon.msc----Computer performance monitoring Program
winver---------Check the Windows version
sfc/scannow-----Scan errors and recover
taskmgr-----Task Manager (2000/xp/2003
winver---------Check the Windows version
wmimgmt.msc----Open Windows Management Architecture (WMI)
wupdmgr--------Windows Update
wscript--------Windows Script Host Settings
. Write----------WordPad
winmsd---------System Information
wiaacmgr-------Scanner and Camera Wizard
winchat--------XP comes with LAN chat
mem.exe--------Show Memory usage
Msconfig.exe---System Configuration Utility
mplayer2-------Easy widnows Media Player
MSPaint--------Drawing Board
Wuyi mstsc----------Remote Desktop Connection
mplayer2-------Media Player
magnify--------Magnifier utility
The . MMC------------Open the console
mobsync--------Synchronization command
dxdiag---------checking DirectX information
drwtsn32------System Doctor
devmgmt.msc---Device Manager
dfrg.msc-------Disk Defragmenter
diskmgmt.msc---Disk Management utility
dcomcnfg-------Open System Component Services
ddeshare-------turn on DDE sharing settings
dvdplay--------DVD player
. net stop Messenger-----Stop messenger Service
The . Net start Messenger----Start Messenger Service
Notepad--------Open Notepad
nslookup. Tool Wizard for-------Network management
. ntbackup-------system backup and restore
narrator-------Screen narrator
ntmsmgr.msc----Mobile Storage Manager
ntmsoprq.msc---Mobile Storage Administrator action Request
netstat-an----(TC) command Check interface
Syncapp--------Create a Briefcase
sysedit--------System Configuration Editor
sigverif.-------File Signature Validator
sndrec32-------Recorder
SHRPUBW--------Create a shared folder
secpol.msc-----Local Security Policy
Syskey---------System encryption, once encrypted can not be solved, to protect the Windows XP system dual Password
services.msc---Local Service settings
Bayi. Sndvol32-------Volume Control program
sfc.exe--------System File Checker
Sfc/scannow---Windows File Protection
tsshutdn-------60-second Countdown shutdown command
3. Tsshutdn-------60 seconds Countdown shutdown command
tourstart------XP profile (roaming XP programs that appear after installation is complete)
taskmgr--------Task Manager
eventvwr-------Event Viewer
eudcedit-------Character-font procedure
The . Explorer-------Open Resource Manager
Packager-------Object Wrapping program
perfmon.msc----Computer performance monitoring Program
progman--------Program Manager
regedit.exe----Registration Form
94. rsop.msc-------Group Policy result set
regedt32-------Registry Editor
rononce-p----15-second shutdown
regsvr32/u *.dll----Stop DLL file run
98. regsvr32/u zipfldr.dll------Cancel Zip support
cmd.exe--------cmd command prompt
Chkdsk.exe-----CHKDSK disk Check
101. Certmgr.msc----Certificate Management Utility
102. Calc-----------Start Calculator
103. Charmap--------Start character mapping table
104. CLICONFG-------SQL SERVER Client Network Utility
clipbrd--------Clipboard Viewer
106. conf-----------start NetMeeting
107. Compmgmt.msc---Computer Management
108. cleanmgr-------Waste Finishing
109. Ciadv.msc------Indexing Service Program
Osk------------Open the On-screen keyboard
111. ODBCAD32-------ODBC data Source Manager
oobe/msoobe/a----Check if XP is active.
113. Lusrmgr.msc----Native users and Groups
logoff---------Logoff command
IExpress-------Trojan Bundle tool, System comes with
Nslookup-------IP Address Detectors
117. Fsmgmt.msc-----shared Folder Manager
118. Utilman--------Utility Manager
119. Gpedit.msc-----Group Policy
Explorer -------Open Resource Manager
Java executes a batch command
Import Java.io.inputstream;public class Test1 {public static void Main (string[] args) { String path = "D:\\public . bat "; Runtime run = Runtime.getruntime (); try { //run.exec ("cmd/k shutdown-s-T 3600"); Process process = Run.exec ("cmd.exe/k start" + path); InputStream in = Process.getinputstream (); while (In.read ()! =-1) { System.out.println (In.read ()); } In.close (); Process.waitfor (); } catch (Exception e) { e.printstacktrace ();}} }
Java invoke operating system commands