Roger Luo

超越梦想一起飞
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

命令行的使用 command line

Posted on 2012-10-29 21:00  Roger Luo  阅读(764)  评论(0编辑  收藏  举报

命令行命令列表:

http://ss64.com/nt/



例子1:

@echo off
set kobradir="C:\Program Files\Reuters\Kobra\Program"
set kobra="kobra.exe"
set kobraconfig="C:\Program Files\Reuters\Common\Config\RFA.RFA-configuration-file"
rem check the file whether exist
if exist %kobraconfig% goto checkPTNConfig
echo No found RFA.RFA-configuration-file
goto end
:checkPTNConfig
if exist %kobraconfig%_PTN goto checkIINConfig
echo No found RFA.RFA-configuration-file_PTN
goto end
:checkIINConfig
if exist %kobraconfig%_IIN goto install_prompt
echo No found RFA.RFA-configuration-file_IIN
goto end
rem consult the network which want?
:install_prompt
set /p a=Please choose which network you want to access to? Continue [PTN/IIN]?
if /i '%a:~0,3%'=='PTN' goto Change2PTN
if /i '%a:~0,3%'=='IIN' goto Change2IIN
echo Invalid user input...
goto install_prompt
:Change2PTN
del /f /s /q %kobraconfig% > nul
copy /Y %kobraconfig%_PTN %kobraconfig%
echo Change to PTN : Done
goto end
:Change2IIN
del /f /s /q %kobraconfig% > nul
copy /Y %kobraconfig%_IIN %kobraconfig%
echo Change to IIN : Done
goto end
rem shutdown the kobra
taskkill /f /im %kobra%
:waitforstop
ping -n 5 127.0.0.1 >nul 
tasklist | find /i "kobra.exe" > nul && goto waitforstop 
rem start the kobra
%kobradir%\%kobra%
:end
pause


Windows Service 使用技巧

常用命令

sc query                - Enumerates status for active services & drivers
sc query messenger      - Displays status for the messenger service
sc queryex messenger    - Displays extended status for the messenger service
sc query type= driver   - Enumerates only active drivers
sc query type= service  - Enumerates only Win32 services
sc query state= all     - Enumerates all services & drivers
sc query bufsize= 50    - Enumerates with a 50 byte buffer
sc query ri= 14         - Enumerates with resume index = 14
sc queryex group= \"\"    - Enumerates active services not in a group
sc query type= service type= interact - Enumerates all interactive services
sc query type= driver group= NDIS     - Enumerates all NDIS drivers


快速显示网络连接状态的命令(open the network connections in command) supproted by windows xp, vista, 7, 2003server, 2008server.

ncpa.cpl

控制面板其他命令

Accessibility Options
access.cpl

Add/Remove Programs
appwiz.cpl

Add Hardware Wizard
hdwwiz.cpl

Administrative Tools
admintools

Automatic Updates
wuaucpl.cpl

Bluetooth Properties
bthprops.cpl

Control Panel
panel

Desktop Properties
desktop

Desktop Appearances Properties
color

Display Properties
desk.cpl

Fastfind Properties
findfast.cpl

Firewall Properties
firewall.cpl

Fonts Folder
fonts

Game Controllers
joy.cpl

Infrared Properties
infrared

Internet Options
inetcpl.cpl

iSCSI Initiator
iscsicpl.cpl

Java Control Panel
jpicpl32.cpl

Keyboard Properties
main.cpl keyboard

Licensing Mode
liccpa.cpl

Mouse Properties
main.cpl

Network Connections
ncpa.cpl

Network Setup Wizard
netsetup.cpl

ODBC Properties
odbccp32.cpl

Power Options
powercfg.cpl

Printers Folder
printers

Regional and Language Options
intl.cpl

Scanners and Camera Properties
sticpl.cpl

Schedule Tasks
schedtasks

Sound and Audio Devices
mmsys.cpl

Stored Passwords
keymgr.cpl

System Properties
sysdm.cpl

Telephone and Modem Properties
telephon.cpl

Time and Date Settings
timedate.cpl

User Accounts
nusrmgr.cpl

User Accounts Advances
userpasswords2

User Passwords
userpasswords

Windows Security Center
wscui.cpl

Wireless Link
irprops.cpl

复制文件夹

复制相对路径文件,相对路径需要使用双引号来括住。

if not exist d:\cmp\temp mkdir d:\cmp\temp

xcopy /Y /E "../conf" d:\cmp\temp

copy /Y /E "../conf" d:\cmp\temp

两者区别是xcopy可以递归的复制源文件下的子文件夹。

创建新文件

copy nul newfile.txt > nul

命令行睡眠

可以使用ping 127.0.0.1 –n num来决定睡觉几秒

ping 127.0.0.1 -n 3 >nul