dos taskkill 命令
C:\Users\asn\Desktop>taskkill /?
TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
Description:
This tool is used to terminate tasks by process id (PID) or image name.
Parameter List:
/S system Specifies the remote system to connect to.
/U [domain\]user Specifies the user context under which the command should execute. 指定命令执行的用户上下文
/P [password] Specifies the password for the given user context. Prompts for input if omitted. 为指定的用户上下午指定密码
/FI filter Applies a filter to select a set of tasks.
Allows "*" to be used. ex. imagename eq acme*
/PID processid Specifies the PID of the process to be terminated. 指定将被终止进程的PID, 使用tasklist获取PID
Use TaskList to get the PID.
/IM imagename Specifies the image name of the process to be terminated. 指定将被终止的进程映像名
Wildcard '*' can be used to specify all tasks or image names.
/T Terminates the specified process and any child processes which were started by it.
终止指定的进程和其所有子进程
/F Specifies to forcefully terminate the process(es). 强制终止进程
/? Displays this help message.
Filters:
Filter Name Valid Operators Valid Value(s)
----------- --------------- -------------------------
STATUS eq, ne RUNNING | NOT RESPONDING | UNKNOWN
IMAGENAME eq, ne Image name
PID eq, ne, gt, lt, ge, le PID value
SESSION eq, ne, gt, lt, ge, le Session number.
CPUTIME eq, ne, gt, lt, ge, le CPU time in the format of hh:mm:ss.
hh - hours, mm - minutes, ss - seconds
MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB
USERNAME eq, ne User name in [domain\]user
format
MODULES eq, ne DLL name
SERVICES eq, ne Service name
WINDOWTITLE eq, ne Window title
NOTE
----
1) Wildcard '*' for /IM switch is accepted only when a filter is applied.
2) Termination of remote processes will always be done forcefully (/F).
3) "WINDOWTITLE" and "STATUS" filters are not considered when a remote
machine is specified.
Examples:
TASKKILL /IM notepad.exe ## 终止进程映像名为 notepad.exe 的进程
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM cmd.exe /T ## 强制终止进程映像名为cmd.exe进程,并终止从其启动的所有子进程
例如,终止所有的java.exe进程: taskkill /f /im java.exe /t
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*" ## 终止进程PID > 1000 且 window title 不等于 untitle* 的所有进程
TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"
findstr命令
C:\Users\asn\Desktop>findstr /? Searches for strings in files. FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file] [/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]] strings [[drive:][path]filename[ ...]] /B Matches pattern if at the beginning of a line. /E Matches pattern if at the end of a line. /L Uses search strings literally. /R Uses search strings as regular expressions. /S Searches for matching files in the current directory and all subdirectories. 在当前目录和其子目录搜素匹配的文件 /I Specifies that the search is not to be case-sensitive. 默认搜素大小写敏感,指定大小写不敏感 /X Prints lines that match exactly. 打印出匹配的行 /V Prints only lines that do not contain a match. /N Prints the line number before each line that matches. 在每个匹配行前,打印行号 /M Prints only the filename if a file contains a match. 如果文件包含匹配,仅打印文件名 /O Prints character offset before each matching line. 在每个匹配行前,打印字符偏移 /P Skip files with non-printable characters. 忽略带有不可打印字符的文件 /OFF[LINE] Do not skip files with offline attribute set. 不要忽略设置了offline属性的文件 /A:attr Specifies color attribute with two hex digits. See "color /?" 使用2个十六进制数指定color属性 /F:file Reads file list from the specified file(/ stands for console). 从指定的文件中读取文件列表 /C:string Uses specified string as a literal search string. 使用指定的字符串作为一个字面搜索串 /G:file Gets search strings from the specified file(/ stands for console). 从指定的文件中获取搜索字符串 /D:dir Search a semicolon delimited list of directories 搜索一个逗号分隔的目录 strings Text to be searched for. 待搜索的文本 [drive:][path]filename Specifies a file or files to search. 指定一个文件、一些文件用于搜索 Use spaces to separate multiple search strings unless the argument is prefixed with /C. For example, 'FINDSTR "hello there" x.y' searches for "hello" or "there" in file x.y. ## FINDSTR "hello there" x.y 搜索hello或there 'FINDSTR /C:"hello there" x.y' searches for "hello there" in file x.y. ## FINDSTR /C:"hello there" x.y 把"hello there"当做一个整体在x.y文件中搜索 Regular expression quick reference: . Wildcard: any character * Repeat: zero or more occurrences of previous character or class ^ Line position: beginning of line $ Line position: end of line [class] Character class: any one character in set [^class] Inverse class: any one character not in set [x-y] Range: any characters within the specified range \x Escape: literal use of metacharacter x \<xyz Word position: beginning of word xyz\> Word position: end of word For full information on FINDSTR regular expressions refer to the online Command Reference.