1. Lệnh Ping : Cú pháp: Code: ping ip/host [/t][/a][/l][/n]



tải về 1.67 Mb.
Chế độ xem pdf
trang34/92
Chuyển đổi dữ liệu18.05.2022
Kích1.67 Mb.
#52014
1   ...   30   31   32   33   34   35   36   37   ...   92
Cac lenh co ban trong DOS

 
Example:
If two files are compared and the four lines of text match as follows 


1: different 
2: same 
3: same 
4: different 
Specifying /nnnn =2 the file compare will display the 4th line and continue
Specifying /nnnn =3 the file compare will halt at the 4th line (files too different) 
Specifying /LB1 the file compare will halt after the first line 
# Oh lord won't you buy me a Mercedes Benz, my friends all drive Porsches, I must make 
amends # - Janice Joplin 
FIND
 
Search for a text string in a file & display all the lines where it is found. 
Syntax 
FIND [/V] [/C] [/N] [/I] "string" [pathname(s)] 
key 
/V : Display all lines NOT containing the specified string. 
/C : Count the number of lines containing the string. 
/N : Display Line numbers. 
/I : Ignore the case of characters when searching for the string. 
"string" : The text string to find (must be in quotes). 
[pathname] : A drive, file or files to search. 
If a [pathname] is not specified, FIND will prompt for text input or will accept text piped from 
another command. 
(use CTRL-Z to end manual text input) 
If searching for text that contains quote characters 
"
, they should be escaped by doubling to 
""
Examples:
If names.txt contains the following: 
Joe Bloggs, 123 Main St, Dunoon
Arnold Jones, 127 Scotland Street, Edinburgh 
To search for "Jones" in names.txt 
FIND "Jones" names.txt 
---------- NAMES.TXT 
Arnold Jones, 127 Scotland Street, Edinburgh 
If you want to pipe the output from a command into FIND use this syntax 
TYPE names.txt | FIND "Jones"
You can also redirect like this 
FIND /i "Jones" < names.txt >logfile.txt 
To search a folder for files that contain a given search string: 
FOR %G IN (*.txt) do (find /n /i "SearchWord" "%G") 
“Instead of getting married again, I'm going to find a woman I don‟t like and just give her a 
house” - Lewis Grizzard 


FINDSTR
 
Search for strings in files. 
Syntax 
FINDSTR [options] [/F:file] [/C:string] [/G:file
[/D:DirList] [/A:color] [/OFF[LINE]] [string(s)] [pathname(s)] 
FINDSTR [options] [/F:file] [/R] [/G:file
[/D:DirList] [/A:color] [/OFF[LINE]] [string(s)] [pathname(s)] 
Key 
string Text to search for. 
pathname(s) The file(s) to search.
/C:string Use string as a literal search string. 
/R Use string as a regular expression. 
/G:file Get search string from a file (/ stands for console). 
/F:file Get a list of pathname(s) from a file (/ stands for 
console). 
/A:color Display filenames in 
colour
 (2 hex digits) 
/d:dirlist Search a comma-delimited list of directories. 
options may be any combination of the following switches: 
/I Case-insensitive search. 
/S Search subfolders. 
/P Skip any file that contains non-printable characters 
/OFF[LINE] Do not skip files with the OffLine 
attribute
 set. 
/L Use search string(s) literally. 
/B Match pattern if at the Beginning of a line. 
/E Match pattern if at the END of a line. 
/X Print lines that match exactly. 
/V Print only lines that do NOT contain a match. 
/N Print the line number before each line that matches. 
/M Print only the filename if a file contains a match. 
/O Print character offset before each matching line. 
If more than one file is searched, the results will be prefixed with the filename where the text was 
found. 
Option syntax 
Options can be prefixed with either 
/
or 
-
Options may also be concatenated after a single / or -. However, the concatenated option list 
may contain at most one multicharacter option such as 
OFF
or 
F:
, and the multi-character option 
must be the last option in the list. 
The following are all equivalent ways of expressing a case insensitive regex search for any line 
that contains both "hello" and "goodbye" in any order 
/i /r /c:"hello.*goodbye" /c:"goodbye.*hello" 
-i -r -c:"hello.*goodbye" /c:"goodbye.*hello" 
/irc:"hello.*goodbye" /c:"goodbye.*hello" 

tải về 1.67 Mb.

Chia sẻ với bạn bè của bạn:
1   ...   30   31   32   33   34   35   36   37   ...   92




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương