Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Hitme batch collection


May 23, 2021 DOS Command learning manual





This text document is converted from pdf format due to conversion limitations,

There may be a broken line in the code, please be careful to check during use.


-----------------------------------------------------------------------------



1. CMD.mdb


1. 16<=>10


Want to turn into a system under cmd, do your own addition and subtract multiplication and divide? D rink too much and die of a headache, forget it


Stole the chicken and used pings and set to help with the operation


Hoho, nothing, will speculate, giant shoulder stop, where is the technology?


Usage: DxH number


For example:


DxH 1234567


DxH 0x1234fd3


@echo off


if "%1" "" goto :syntax


if "%1" "/?" goto :syntax


:H2D


set tmpx=%1


if "%tmpx:~0,2%" "0x" (


for /f "delims=" %%i in ('set /a %1') do (


echo.


echo %1 = %%i


goto :end


)


)


:D2H


setlocal ENABLEDELAYEDEXPANSION


for /f "tokens=2" %%i in ('ping %1 -n 1 -w 1 ^|find "Pinging"') do (


for /f "tokens=1-4 delims=." %%a in ("%%i") do (


set /a tmp1 = %%a / 16


set /a tmp2 = %%a - 16 * !tmp1!


set /a tmp3 = %%b / 16


set /a tmp4 = %%b - 16 * !tmp3!


set /a tmp5 = %%c / 16


set /a tmp6 = %%c - 16 * !tmp5!


set /a tmp7 = %%d / 16


set /a tmp8 = %%d - 16 * !tmp7!


for /l %%a in (1,1,8) do (


if !tmp%%a! 10 set tmp%%a=!tmp%%a:10=A!


if !tmp%%a! 11 set tmp%%a=!tmp%%a:11=B!


if !tmp%%a! 12 set tmp%%a=!tmp%%a:12=C!


if !tmp%%a! 13 set tmp%%a=!tmp%%a:13=D!


if !tmp%%a! 14 set tmp%%a=!tmp%%a:14=E!


if !tmp%%a! 15 set tmp%%a=!tmp%%a:15=F!


)


)


)


echo.


echo %1 = 0x!tmp1!! t mp2!! t mp3!! t mp4!! t mp5!! t mp6!! t mp7!! t mp8!


endlocal


:end


goto:eof


:syntax


Cls


echo.


echo. D xH.cmd 16-step script. W ritten by hitme 2005.7.27


echo.


Echo.Usage: DxH number


echo.


echo. For example: DxH 1234567


echo. D xH 0x1234fd3


DxH.rar


2. CCF


attachment.rar


3. cmd


Description: There is a party, to achieve the goal of the present personnel, random group play team games...


Be able to enter your name at will, and when you're done, display your randomly grouped names on the screen


Set the name text as .txt, a line of names


The grouping rule is: 4 people in a group


The idea is: garbled numbering, number sorting, disorderly ordering, and then grouping


Random space size of 10 3 squares, dozens of people party should be enough


Get the .txt, save it for xy.cmd run, and customize the red section


@echo off


for /f "delims=" %%i in (name.txt) do (


setlocal ENABLEDELAYEDEXPANSION


for /l %%a in (1,1,3) do (


echo %random% >nul


set m=!m!! r andom:~-1!


)


echo !m!!:%%i>>tmp.txt


endlocal


)


setlocal ENABLEDELAYEDEXPANSION


set /a num=0


set /a linenum=0


for /f "delims=" %%i in (tmp.txt) do set /a linenum=!linenum!+1


for /f "tokens=1,2* delims=: " %%i in ('sort tmp.txt ^| f indstr /n


"."') d o (


set n=%%k


set m=!m!! N !


set /a num=!num!+1


if !num! 4 (


echo !m!>>tmp1.txt


set /a num=0


set m=)


if "%%i" "!linenum!" (


if "!m!" neq "" echo !m!>>tmp1.txt)


)


endlocal


findstr /n "." tmp1.txt>list.txt


del tmp*.txt


start list.txt


xy.rar


4. cmd


some text processing under cmd


Run a question at the beginning, intersperse an advertisement, launch grandly, slugs, excel! excel! excel! excel!


m$That spreadsheet software? W hat do you do with it? I sn't that a run?


Do line text processing! S ort, filter, insert in the middle, turn over, pour one by one, odd-even swap, extract


1, 4, 9. Rows, Merge, Cross Merge, First Row Fill odd rows, etc. 72 changes


Compared to xnix shell, all kinds of text editing software, no less, getting started is also easier, help files more


For detailed, real home travel, killing cross-border strong goods, no concept hastened to try.


All you need to do is think about it. I deas.. I deas are important!


Words are still passed on, or cmd, with it to do text processing, can only be regarded as difficult for it, fit together, often


Take a deep breath and be careful to give it away


1. List multiple text file file names and file contents


2. Construct 001.txt 002.txt 999.txt the text content is text001 text002


3. Http://..001| 002|003./01|02|03 .htm sequence


4. Convert a bunch of text-form URLs separately into shortcuts to IE favorites


5. Export IE favorites as CSV documents


6. There are txt files .txt and a .txt are stored in the file list, find out a .txt not in it


, and all .txt list of files in the folder


7. Words in the text file are automatically counted and sorted in full text


8. Count the number of times a word appears in a text file?


9.GB and Maxthon group conversion


10. Merge 2 subtitle text files


11.snap and compare fixed content for multiple htmls


1. List multiple text file file names and file contents


find /v "" *.txt >list.txt


Continue to observe the valuable output of the own commands


------------------------------------------------------------


2. Construct 001.txt 002.txt 999.txt the text content is text001 text002


for /l %i in (1,1,9) do @echo text00%i >00%i.txt


for /l %i in (10,1,99) do @echo text0%i >0%i.txt


for /l %i in (100,1,999) do @echo text%i >%i.txt


:: Segments to make up for zeros


-----------------------------------------------------------------


3. Construction http://..001| 002|003./01|02|03 .htm, the following is saved as .bat file


Perform


Code:


setlocal ENABLEDELAYEDEXPANSION


for /l %%i in (1001,1,1162) do for /l %%j in (101,1,112) do @(set


s=%%i && set t=%%j && echo ^<td^>^<a


href="http://www.sergeaura.net/TGP/!s:~1,3!/images/!t:~1,2!.jpg" rel="external nofollow" target="_blank" ^>!s


:~1,3!! t:~1,2!. jpg^</a^>^</td^> >>file.htm)


endlocal


Nested for, two sets of variables


00x, 0x serial number construction, plus or minus high ccfer su99 original


------------------------------------------------------------


4. Convert a bunch of text-form URLs separately into shortcuts to IE favorites


for /f "tokens s 1,2,3 delims s:/" %i in ('findstr /n'." text.txt') do


echo [InternetShortcut] >>%k_%i.url && echo url=http://%k


>>%k_%i.url


There's nothing special about it


------------------------------------------------------------


5. Export IE favorites as CSV documents, save the following as .bat file execution


Code:


for /f "tokens=1,3,4 delims=:" %%i in ('findstr /s "http" *.url') do


if %%k neq 0 (echo %%i,http:%%j:%%k >>list.csv) else echo


%%i,http:%%j >>list.csv


Findstr /s . . . get the relative path of the file and take advantage of it


------------------------------------------------------------


6. There are txt files .txt and a .txt are stored in the file list, find out a .txt not in it


, and all .txt list of files in the folder


# Have TXT file all.txt and a .txt hold a list of files, and a .txt is all.txt


Subset, find out the list of .txt not in the a-.txt in the all-in-one


for /f "delims=" %i in (all.txt) do @findstr /x /c:"%i" a.txt >nul


|| @ findstr /x /c:"%i " b.txt >nul || @ echo %i>>b.txt


Continuous ||: || A pplication


------------------------------------------------------------


7. Words in the text file are automatically counted and sorted in full text


A text file with one word or string (repeated) on each line, with thousands of lines. U se word or


UE can only do to rearrange in dictionary order, or select a word to count its number.


Is there a way to automatically count the number of times each different word appears and output a list of results (?


Sorting the number of appearances is even better).


Source file content:


Abc


adfg


Aew


dew


Abc


Abc


Aew


adfg


Abc


dew


adfg


ewq


Abc


Automatically count and sort the output list (assuming):


abc 5


adfg 3


aew 2


dew 2


ewq 1


Set the input text to tmp


for /f "delims=" %i in (tmp) do @echo %i >> %i.txt


@findstr /n "." *.txt >tmp1


for /f "tokens=1-3 delims=:" %i in (tmp1) do @echo %k %j>%i


copy *.txt result.txt


Category summary, excel, awk. W hen it doesn't work, cmd resists


The line number is the quantity


------------------------------------------------------------


8. Count the number of times a word appears in a text file? , the following is saved as .bat file execution


find_word.bat


Code:


@echo off


setlocal ENABLEDELAYEDEXPANSION


set /p file - Please enter the file name you want to query:


set /p name - Please enter the word you want to query:


set /a n=0


:loop


set /a n=n+1


for /f "tokens=%n% delims=,;. ( )[]{}!? " %%i in (%file%) d o if /i %%i


equ %name% echo %name% >>%name%.txt


if %n% neq 255 (goto loop) else goto end


:end


for /f "delims=:" %%i in ('findstr /n "." %name%.txt') do set x=%%i


Echo %name% appears: %x%


del %name%.txt


endlocal


For word matching, the slow-death kind, pure yy


------------------------------------------------------------


9.GB and Maxthon group conversion, the following is saved as .bat file execution


GB and Maxthon groups are transferred .bat


Code:


@echo off


:common


setlocal ENABLEDELAYEDEXPANSION


findstr "CaptorGroup" *.cgp && goto max_gb || g oto gb_max


:max_gb


rd /s/q gb_group


md gb_group


for %%i in (*.cgp) do echo [Group]>>gb_group\\%%i


for %%a in (*.cgp) do for /f "tokens=1-4 delims :" %%i in ('findstr


/n "=" "%%a " ') do set /a n=%%i-2 && echo


name!n!=%%j>>gb_group\%%a && echo ^url!n!=%%k:%%l>>gb_group\%%a


goto end


:gb_max


rd /s/q max_group


md max_group


for %%a in (*.cgp) do for /f "tokens=2 delims " %%i in ('findstr


"." "%%a " ') do echo %%i>>max_group\%%~na.txt


for %%a in (max_group\*.txt) do echo


[CaptorGroup]>>max_group\%%~na.cgp


for %%a in (max_group\*.txt) do for /f "tokens=1,2 delims=: " %%i in


('findstr "." "%%a " ') do if "%%i" neq "http" (set


n=%%i) else (if "%%i" "http" echo


!n!=http:%%j>>max_group\%%~na.cgp)


del /q max_group\*.txt


goto end


endlocal


:end


Cls


Echo conversion is complete, please review the subdirect directory


pause


exit


Two lines in one line, two lines apart in one row


------------------------------------------------------------


10. Merge 2 subtitle text files


Merge 2 subtitle text files


The original file 1 is as follows


Code:


1


00:00:17,920 --> 00:00:18,625


Charlie?


2


00:00:19,858 --> 00:00:20,606


Charlie?


3


00:00:21,635 --> 00:00:23,140


How about going for a walk with me?


4


00:00:23,739 --> 00:00:24,456


No


5


00:00:24,972 --> 00:00:27,317


No, no, Locke, I don't want to go anywhere today


The original file 2 is as follows


Code:


1


00:00:17,820 --> 00:00:18,525


Charlie?


2


00:00:19,758 --> 00:00:20,506


Charlie?


3


00:00:21,535 --> 00:00:23,040


How about you and I go for a walk?


4


00:00:23,639 --> 00:00:24,356


No.


5


00:00:24,872 --> 00:00:27,217


No, thanks, Locke. I think I'm gonna stay in today.


The merged files are required as follows


Code:


1


00:00:17,920 --> 00:00:18,625


Charlie?


Charlie?


2


00:00:19,858 --> 00:00:20,606


Charlie?


Charlie?


3


00:00:21,635 --> 00:00:23,140


How about going for a walk with me?


How about you and I go for a walk?


4


00:00:23,739 --> 00:00:24,456


No


No.


5


00:00:24,972 --> 00:00:27,317


No, no, Locke, I don't want to go anywhere today


No, thanks, Locke. I think I'm gonna stay in today.


Want to combine Chinese and English subtitles, while watching the film can also learn English


In fact, the software can load 2 subtitles at the same time, you can also implement the requirements


But I'm watching movies on Xbox now, and XBMC can only support one at a time


srt subtitles, so there will be this requirement


The file name file1 is .txt file2 .txt, and the following is saved as .bat file execution


f.bat


Code:


del 1.txt 2.txt all .txt merged documents .txt


Echo plus a line of 2 .txt


type file2.txt >>2.txt


copy file1.txt 1.txt


: # 源 文件备


findstr /n "." 1 .txt 2.txt >tmp.txt


: # 合 合 文件 and add a line number


for /l %%i in (1,1,500) do findstr /r "^1.txt:%%i:" tmp.txt


>>all.txt || f indstr /r "^2.txt:%%i:" tmp.txt >>all.txt


: # Analysis, Construct The Target File


for /f "tokens" s3, s delims s: %%i (all.txt) do echo %j sgt; merge


The document is .txt


: # Filter excess information


Cross merge


------------------------------------------------------------


11.snap and compare fixed content for multiple htmls


There are the following


http://www.abcd.com/pub/wrok1.html


http://www.abcd.com/pub/wrok2.html


http://www.abcd.com/pub/wrok3.html


.


..


...


http://www.abcd.com/pub/wrok(*).html


Every html, almost the entire html section is fixed, except for what I want to monitor (text open.)


Line 225, start at 38th, end with 75th, they


There's a change from time to time, and all the html updates may be more than that, but I just want to monitor this


A


Is there any software or method snap mirror once, and then the next time after snap to make a comparison to the last snap?


Which url's html content monitoring segment has changed?


No error control, the following is saved as .bat file execution


snap&compare.bat


Code:


@echo off


del difference .txt 2 sgt;nul


copy /y snap.txt snap_old.txt 1>nul


: # 清 清 and grief SNAP


:snap


echo %date% %time% >snap.txt


: # Add timestamp


set url=http://www.abcd.com/pub/wrok


: #url variable assignment


for /l %%i in (1,1,100) do curl %url%%%i.html | f indstr /n "." |


findstr /r "^225:" >>tmp.txt && echo %url%%%i >>tmp.txt


: # Download HTM and filter the required row


setlocal ENABLEDELAYEDEXPANSION


for /f "tokens=1* delims=:" %%i in (tmp.txt) do if "%%i" "http"


(echo %%i%%j !n! >>snap.txt) else set n=%%j


endlocal


: # 成 快 快照


del tmp.txt


: # Delete temporary files


:goto


If not snap_old.txt the first time a snapshot file has been established


Snap.txt, please run snap and compare.cmd again to get file differences and pause


&& goto end


: # Judging whether there is a comparative snapshot, No Difference Comparison IS Made if it does not exist


:compare


findstr /n "." snap.txt >tmp1.txt


findstr /n "." snap_old.txt >tmp2.txt


: # Add a line number for Snap text


for /l %%i in (2,1,100) do findstr /r "^%%i:" tmp1.txt tmp2.txt


>>tmp3.txt


: # Merged TMP files in the line number


findstr /r "1:".txt the difference is .txt


: # Add timestamp


setlocal ENABLEDELAYEDEXPANSION


for /f "tokens=1* delims=:" %%i in (tmp3.txt) do if %%i tmp1.txt


(set n = %% j) else (if %% j NEQ! N! Echo %% J >> Differences .txt)


endlocal


: # Comparison Text, Calculate The Difference Line and Line Number


del tmp*.txt


: # Clean temporary files


To complete the comparison of differences, please review the "differences .txt" and the "differences"


pause


end:


Two lines in parallel, similar text comparison


5. cmd


Some file processing under cmd:


1. Keep folder structure, copy specific size, time, type file


2. Keep the folder structure, copy file name, content empty


3. Move files to the target directory by the number of files


4.copy a layer (3.4..5) subdirectle of files to the target path


5. Delete a file in a folder that does not have an extension, such as txt


6. Copy files with the same name under different folders to the destination folder


7. The same file copy to all sub-folders


8. Handle all extensions e?? a nd is not an exe file


9. Each file generates a folder with the same name, and then copies each file into a folder with the same name


10. Delete the empty folder


1. Keep folder structure, copy specific size, time, type file


# Specific type


the xcopy /s/y .exe the target path


Many separate commands (dir; x copy and so on) itself is full of change, make good use of it


# Specific size


(e.g. less than 50,000 bytes, specific operation symbol: EQU - equal to NEQ - inequality LSS - less than LEQ.)


- NEQ - not equal to)


for /r %i in (.)) do if %-zils 50000 xcopy /s "%i" target path %-pi"


The circular weapon for command can be used with a number of commands, such as if, findstr, echo, etc


Here with it enumeration sub-folder under the file, %-zi amplification to file size, to the if command for comparison


Operation, after success xcopy to the target path and copy folder


for command execution order) input, for enumerity, do... W hat do you love for?


# Specific time


Example: Copy a file at a specific time (2005-04-19), the following is saved as .bat file execution


Code:


setlocal ENABLEDELAYEDEXPANSION


for /r %%i in (*.*) do set dd=%%~ti && if "!dd:~0,8!" " 05-04-19"


xcopy /s "%%i" Target Path %%-pi"


endlocal


The same as the last one, or for, if, xcopy, because you can not directly for variable % to ti % to ti: to 0, 8 this


kind of extension, work it out, set to ordinary variables, and then do extensions


Description of the extension of the %var to: 0,8%: Two numbers represent the offset and length, see set /?


For ENABLEDELAYEDEXPANSION delayed environment variable expansion, see set /?, there are examples


-----------------------------------------------


2. Keep the folder structure, copy file name, content empty


xcopy /t/s. target path


for /r %i in (.) do echoc sgt; target path "%-pnxi"


xcopy /t/s establishes mirror folders, for /r in (.) enumeration sub-folder files, utilize


Echoc bug, write 0 byte file


-----------------------------------------------


3. Move the file to the target folder by the number of files, and save the following as .bat the file execution


Code:


setlocal ENABLEDELAYEDEXPANSION


set /a n=0


:loop


set /a n=n+1


md folder%n%


For %%i in (.)do move "%%i" folder %n% and dir folder %n% | f indstr


/c: "100 files" and "goto loop."


endlocal


The requirements will be the source folder files, every 100 moved to the folder 1. 2 ..3


:: for (


100


-----------------------------------------------


4.copy a layer (3.4..5) subdirectle of files to the target path


# Copy the files below the 3rd floor folder to the target path


dir /s/b/a:d >d.txt


for /f "tokens=1-4 delims=\" %i in (d.txt) do echo n | x copy /e


The target path of "%i\%j\%k\%l"


The dir lists sub-folders without title information or summaries and redirects them to .txt


*for /f .. ( d.txt), analyze d.txt, cross xcopy replication


You can also use for /f . . . directly. ( 'dir /s/b/a:d') the do dir output is captured into memory as if it were


File analysis. W riting in two lines is primarily about script efficiency when folders are complex


-----------------------------------------------


5. Delete a file in a folder that does not have an extension, such as txt


for /f "delims=/" %i in ('dir /b/s *.*') do dir /b/s *.txt | f ind


"%i" || d el "%i"


The output of the dir is caught, looked in the .txt of the dir* and not found is not a txt file, deleted


Can be expanded to non-txt-jpg-gif files, will not be eye-catching


-----------------------------------------------


6. Copy files with the same name under different folders to the destination folder


There is a file 123 under folder 1.jpg


There is also a file 123 under folder 2.jpg file name is the same, the content is different


There is also a file 123 under folder 3.jpg file name is the same, the content is different


......


I want to search for all .jpg 123 files, copy to a target folder, but I use search-and-search-to-copy


system, the latter overrides the former problem, can only keep a file 123 .jpg, there is no


How do you copy these files with the same name under the same folder? O r how to automatically rename the search


File?


dir /s/b 123.jpg | f ind /n "123.jpg" >temp.txt


for /f "tokens=1,2 delims=[]" %i in (temp.txt) do copy "%j" d:\123-


"%i".jpg


Enumeration of the full path .jpg all 123 files, with the line number redirected to the .txt


For /f () do copy is also renamed 123-line number.jpg line number will not be repeated, take advantage of it


-----------------------------------------------


7. The same file copy to all sub-folders


for /r %a in (.) do xcopy /y filename "%~pa"


*for /r .. ( .) D o enumers only folders


-----------------------------------------------


8. Handle all extensions e?? a nd is not an exe file


for %i in (*.e??) do if /i "%~xi" neq ".exe" echo %i


-----------------------------------------------


9. Each file generates a folder with the same name, and then copies each file into a folder with the same name


for %i in (*.*) do md "%~ni" && copy %i "%~ni"


------------------------------------------------


10. Delete the empty folder


for /l %a in (1,1,9) do for /r %i in (.) do rd %~si


6. cmdhtm


list.rar


1.rar


7. cmd


cmd some other applications


1. Quickly build users and share folders


2. Let the server shut down or hibernate automatically when idle


3. Automatic backup of files via FTP


4. Scan a network segment. U se for and ping. Then get the survival host to save the results between ip and ip, separated


Open


5. The list of files under DOS is incremental by file name length


6. Remote shutdown


1. Quickly build users and share folders


It's time to install the student room again


Because there is now a requirement that:


Add users (A1, A2) to the 、...... A 7、B1...... H 7) (corresponding to the student machine)


Build directory sharing on a teacher's machine (to correspond to the machine...) )


Is to build the A1 directory for the A1 machine.


It's so complicated, is there any good introduction?


for %i in (a b c d e f h) do for /l %j in (1,1,7) do echo %i%j


>>name.txt


: # Construct the serial number file


for /f %i in (name.txt) do net user %i %i /add


: # 天家 商


for /f %i in (name.txt) do md %i


: # 建 目 目


for /f %i in (name.txt) do net share %i?


: # Share the directory


for /f %i in (name.txt) do cacls \%i /g %i:f administrator:f


: # Configure permissions, return all the way, you can


There's no complicated


---------------------------------------------------------------


2. Let the server shut down or hibernate automatically when idle


Unit has a local area network, due to win2000 server agent Internet access, intranet IP: 192.168.0.


Because everyone from time to time on the Internet, generally in the middle of the night no one to use the network, but can not do a one-size-fits-all, no


Can set a certain time automatic shutdown, is seeking a software, can automatically detect the intranet has no one to turn on, if sent


Now after 0 o'clock, half an hour without access to the Internet, the server automatically shut down (or hibernate), I found


Poweroff software does not do this. I hope you can help.


Run .bat # Plan task this ba at 0:30. R epeat every 30 minutes. B e careful not to ping


Server, not tested, is not very reliable


The following is saved as .bat file execution


Code:


del reply.txt


Echo Shutdown Logs and reply .txt


for /l %%i in (2,1,254) do ping -n 1 192.168.0.%%i | f ind "Reply"


>>reply.txt


find "Reply" reply.txt || s hutdown


---------------------------------------------------------------


3. Automatic backup of files via FTP


Machine A


D:\\aaa\a\ ——》a.rar


D:\\bbb\ ————》b.rar


An RAR file is automatically generated every 2 hours and stored in the directory of D:?bak\date\time?directory


(D:\bak\2005-01-04\02.00)) is then automatically transmitted via FTP to Machine B (dedicated backup machine).


device)


Could you tell me who can help write a script Thank you. O r omit the compression process and transfer the folder directly


?Transfer directory? F lashfxp


The following is saved as .bat file execution


Code:


@echo off


path=%path%; c :\program files\winrar


:rar


set tdate=%date:~4,10%


set ttime=%time:~0,2%


mkdir "d:\bak\%tdate%\%ttime%"


rar a -r "d:\bak\%tdate%\%ttime%\a.rar" d:\aaa\*.*


rar a -r "d:\bak\%tdate%\%ttime%\b.rar" d:\bbb\*.*


:ftp


echo open ftp.hitme.com >ftp.txt


echo hitme >>ftp.txt


echo password >>ftp.txt


echo bin >>ftp.txt


echo hash >>ftp.txt


echo prompt >>ftp.txt


echo cd bak >>ftp.txt


echo lcd "d:\bak\%tdate%\%ttime%" >>ftp.txt


echo mkdir %tdate% >>ftp.txt


echo mkdir %tdate%/%ttime% >>ftp.txt


echo cd %tdate%/%ttime% >>ftp.txt


echo mput *.* >>ftp.txt


echo cd /bak >>ftp.txt


echo quit >>ftp.txt


ftp -s:ftp.txt


The echo constructs the .txt, utilizing the extended form of the system variable %date% and %time%.


---------------------------------------------------------------


4. Scan a network segment. U se for and ping. Then get the survival host to save the results between ip and ip, separated


Open


for /l %i in (1,1,254) do @echo connecting 192.168.1.%i && @(for /f


"tokens=1,3 skip=2 delims=: " %j in ('ping 192.168.1.%i') do @if


'%j' 'Reply' @find "192.168.1.%i" list.txt > nul 2>nul || @ echo


%k>>list.txt && @echo 192.168.1.%i connected)


*code by su99


:: One-line boutique


---------------------------------------------------------------


5. The list of files under DOS is incremental by file name length


If there are four files in a directory (of course, the actual Chinese number of files and the file name are random)


1.txt,2.txt,10.txt,20.txt


Under DOS how to use how to get them to press


1.txt


2.txt


10.txt


20.txt


Output, not


1.txt


10.txt


2.txt


20.txt


Output?


I use the system is xp - thank you all


for /l %a in (1,1,20) do @(if exist "%a.txt" echo %a.txt)


The idea is to do it poorly. T he premise is that the file name has a certain rule: except for the number of parts to be the same, if so


Abc1.txt, xyz10.txt is such a mess that it doesn't work (strictly enough, if it's limited).


A different pattern, you can still do it, but trouble some)


*code by su99


or


List .bat, the following is saved as .bat file execution


Code:


@echo off


set t=....


:loop


set t=%t%.


dir /b /a:-d | f indstr /r "^%t%$"


if "%t%" "........................." g oto end


goto loop


:end


Findstr/ r "...." filter sorting


---------------------------------------------------------------


6. Remote batch shutdown, the following is saved as .bat file execution


Code:


for /l %%i in (1,1,254) do @(arp -d & ping 192.168.3.%%i -n 1 -w 100


& arp -a | f ind "00-00-00-00-00-00" > nul || s hutdown -m


\\192.168.3.%%i -s -f)


:: Close the icmp, take care of it


8. cmd


Description of some of the symbols in cmd:


&


The simplest combination of commands is to connect n commands and execute them sequentially, whether or not they fail



a & b


# In order to execute a, b


&&


Combining commands, unlike commands, determines whether execution has failed and will not continue if it fails


The remaining commands on the line.


a && b


#A success, B executes


||


It's the opposite of what it's all about


a || B


#A failed, b executes


Linked to the use of a and b || c , which means that a succeeds, executes b, b fails, and performs c


>、>>


The output redirect command writes the output of the command to a file.


Differences: Overwriting writes, and appending writes at the tail


echo a>a.txt


find /v "" *.txt >list.txt


|


Pipeline commands, the output of the previous command as input to the 1st command, are often used for text filtering operations


dir | f ind "hitme.exe"


9. cmdUnicode to ASCII


TYPE Unicode.txt > ASCII.txt


10. Curl-


CURL? W ell, it's been a long time coming


This thing is now one of the command-line tools built into the Apple machine, and it's one of the charms


1)


Don't say anything, start here!


curl http://www.yahoo.com


After returning, www.yahoo.com's html is displayed on the screen


2)


Well, if you want to save the page you read it, do you want it to be like this?


curl http://www.yahoo.com > page.html


Sure, but don't bother!


Just use curl's built-in option, save the html result, and use this option: -o


curl -o page.html http://www.yahoo.com


That way, you can see a download page progress indicator appearing on the screen. a nd so progress to 100%, naturally


That's OK


3)


What's what? N ot accessible? I t must be that your proxy is not set.


When using curl, use this option to specify http access to the proxy server used and its


Port: -x


curl -x 123.45.67.89:1080 -o page.html http://www.yahoo.com


4)


Visiting some websites is annoying, and he uses cookies to record session information.


Browsers like IE/NN can certainly handle cookie information easily, but our curl


? . ....


Let's learn this option: -D slt; this is the cookie information inside the response of http


Save in a special file


curl -x 123.45.67.89:1080 -o page.html -D cookie0001.txt


http://www.yahoo.com


In this way, when the page is .html page, the cookie information is also stored


The cookie 0001 .txt in it


5)


So how do you continue to use the cookie information you left behind the last time you visited? Y ou know


Many websites rely on monitoring your cookie information,


to determine whether you are not following the rules to visit their website.


This time we use this option to add the last cookie information to http request:


-b


curl -x 123.45.67.89:1080 -o page1.html -D cookie0002.txt -b


cookie0001.txt http://www.yahoo.com


In this way, we can simulate almost all IE operations, to visit the web page!


6)


Slightly and so on, I seem to have forgotten something


That's right! I t's browser information


Some nasty websites always require us to use certain browsers to access them, sometimes even more so


Yes, there are certain versions to be used


NND, where is the time to find these weird browsers for it!?


Fortunately, curl provides us with a useful option that allows us to specify our own visit at will


Claimed browser information: -A


curl -A "Mozilla/4.0 (compatible; M SIE 6.0; W indows NT 5.0)" -x


123.45.67.89:1080 -o page.html -D cookie0001.txt


http://www.yahoo.com


In this way, the server side is asked to access and will think you are running on Windows 2000


IE6.0, hey hey hey, maybe you're using an Apple machine!


And "Mozilla/4.73 (en) (X11; U ; L inux 2.2; 1 5 i686" can tell the other person you are


Linux running on a PC, with Netscape 4.73, oh


7)


Another common limitation on the server side is to check the referer for http access. L ike you first


Visit the home page, and then visit the download page specified inside, the second time you visit the referer address is no


The address of the page after a successful visit. T his way, the server side simply discovers a visit to the download page


Referer address is not the home address, you can conclude that it is a stolen link


I hate to hate, I just want to steal the company, I hate to steal, I hate


Fortunately, curl gives us the option to set referer: -e


curl -A "Mozilla/4.0 (compatible; M SIE 6.0; W indows NT 5.0)" -x


123.45.67.89:1080 -e "mail.yahoo.com" -o page.html -D cookie0001.txt


http://www.yahoo.com


In this way, you can trick each other's servers, mail.yahoo.com click on a link from the server


Oh, oh


8)


It says it's missing something important! - ---- can download files with curl


Just now, download the page into a file, you can use -o, download the file is the same.


For example, curl -o 1.jpg http://cgi2.tky.3web.ne.jp/~zzh/screen1.JPG


Here's a new option: -O


Capital O, so use: curl -O


http://cgi2.tky.3web.ne.jp/~zzh/screen1.JPG


This way, you can automatically exist locally according to the file name on the server!


One more is better to use.


If screen1. I n addition to JPG, there are screen2.JPG, screen3. J pg....


screen10. J PG needs to be downloaded, so why don't we write a script to do this?


Don't do it!


In curl, write like this:


curl -O http://cgi2.tky.3web.ne.jp/~zzh/screen[1-10]. J pg


Oh, that's great, isn't it?! ~ ~~


9)


Again, let's continue with the download!


curl -O http://cgi2.tky.3web.ne.jp/~{zzh,nick}/[001-201]. J pg


The resulting download is


~zzh/001.JPG


~zzh/002.JPG


...


~zzh/201.JPG


~nick/001.JPG


~nick/002.JPG


...


~nick/201.JPG


Is that convenient enough? H ahaha


Hey? I t's too early to be happy.


Since the file names under zzh/nick are 001,002..., 201, the downloaded file rename, after


The previous documents have been overwritten out of the . . .


It doesn't matter, we have harder!


curl -o #2_#1.jpg http://cgi2.tky.3web.ne.jp/~{zzh,nick}/[001-


201]. J pg


-- It's.... A download of a custom file name?


-- Head-to-head, huh!


# 1 is a variable, refers to the part of the value of zzh, Nick, The First Value of ZZH, The Second Value of Nick


# 2 Representative Variables, The Second Variable Part --- 001-201, with the value add from 001 to 201


In this way, the custom out downloaded file name becomes this:


Originally: szzh/001.JPG --- after download: 001-zzh. J pg


Originally: snck/001.JPG ---. after download: 001-nick. J pg


In this way, I am not afraid of the re-name of the document, ha ha


9)


Continue with the download


We usually on the windows platform, flashget such a tool can help us block parallel download


can also be passed off-line.


Curl doesn't lose to anyone in these areas


For example, we download screen1. J PG, suddenly dropped, so we can start to renew


curl -c -O http://cgi2.tky.3wb.ne.jp/~zzh/screen1.JPG


Of course, you don't take a flashget download half of the files to fool me


Intercepting documents may not be able to use Oh


Block download, we use this option on it: -r


Give an example


For example, we have http://cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3 to download (Zhao Lao).


The teacher's phone :D )


We can use commands like this:


curl -r 0-10240 -o "zhao.part1"


http:/cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3 &\


curl -r 10241-20480 -o "zhao.part1"


http:/cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3 &\


curl -r 20481-40960 -o "zhao.part1"


http:/cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3 &\


curl -r 40961- -o "zhao.part1"


http:/cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3


This allows you to download it in chunks.


But you need to combine these broken files yourself


If you're using UNIX or Apple, .part cat zhao .mp3 zhao


If you're using Windows, use copy /b to solve it, huh?


All of the above are downloads of the http protocol, in fact, ftp can also be used.


Usage, yes.


curl -u name:passwd ftp://ip:port/path/file


Or you're familiar with it


curl ftp://name:passwd@ip:port/path/file


10)


After the download, it's natural to upload it next


The uploaded option is -T


For example, let's send a file to the ftp: curl -T localfile -u name:passwd


ftp://upload_site:port/path/


Of course, uploading files to the http server is fine


For example, curl -T localfile http://cgi2.tky.3web.ne.jp/~zzh/abc.cgi


Note that at this point, the protocol used is HTTP's PUT method


Just said PUT, hey hey, naturally remind the old clothes of several other methos haven't said yet!


GET and POST can't forget.


http submits a form that is more commonly used in POST mode and GET mode


GET mode doesn't use anything, just write the variables in the url


Like what:


curl http://www.yahoo.com/login.cgi?user=nickwolfe&password=12345


The option of post mode, on the other hand, is -d


For example, curl -d "user-nickwolfe-password-12345"


http://www.yahoo.com/login.cgi


It is equivalent to sending a landing application to this site


Whether to use GET mode or POST mode depends on the program settings of the server opposite.


It is important to note that files in POST mode are uploaded on files, for example


<form method="POST" enctype="multipar/form-data"


action="http://cgi2.tky.3web.ne.jp/~zzh/up_file.cgi">


<input type=file name=upload>


<input type=submit name=nick value="go">


</form>


Such an HTTP form, which we're going to simulate with curl, should be like this syntax:


curl -F upload=@localfile -F nick=go


http://cgi2.tky.3web.ne.jp/~zzh/up_file.cgi


Luo Luo said so much, in fact, curl has a lot of skills and usage


For example, when using a local certificate when https, you can do so


curl -E localcert.pem https://remote_server


For example, you can also use the CURL to check the dictionary through the DICT protocol ~~~~~


curl dict://dict.org/d:computer


Let's talk about it today, huh, huh. Crazy curl features you need you --- to discover.


copyright by nickwolfe@CCF


2004.08.24 21:24 Before the invitation of friends - the first draft


curl.rar


11. MT<->IE cmd


Express group CGP-> favorites URL


conv_c_u.cmd


Running in the MT groups directory


Code


@echo off


setlocal ENABLEDELAYEDEXPANSION


for %%a in (*.cgp) do (


set pathu=ie_url\%%~na


md !pathu!


set /a n=0


for /f "skip=1 tokens=1* delims " %%i in (%%a) do (


if "%%i" "[Properties]" (set /a n=1) else (


if !n! 0 (


echo [InternetShortcut]>>"!pathu!\%%i".url


echo URL=%%j>>"!pathu!\%%i".url)


)


)


)


endlocal


Favorites URL-> Express Group CGP


conv_u_c.cmd


IE_favorites directory running


Code


@echo off


echo [CaptorGroup]>>url.cgp


for /f %%i in ('dir /b/ad') do (


echo [CaptorGroup]>>%%i.cgp


)


setlocal ENABLEDELAYEDEXPANSION


for /f "usebackq tokens=1,2* delims=\=" %%i in (`findstr /s /r


"^URL=" *.url^|findstr "\\"`) do (


set n=%%j


echo !n:~0,-8!=%%k>>%%i.cgp


)


for /f "usebackq tokens=1* delims=\=" %%i in (`findstr /s /r "^URL="


*.url^|findstr /v "\\"`) do (


set n=%%i


echo !n:~0,-8!=%%j>>url.cgp


)


endlocal


conv_c_u.rar


conv_u_c.rar


12. PingDNS


@echo off


if [%1] [] (


set ip=emptyType


set str=Address


) else (


set ip=%1


set str=Name


)


for /f "tokens=2" %%i in ('nslookup %ip% ^|findstr "%str%"') do


ping %2 %3 %%i


13. ping()


Try it, test by win2kchs, some systems pay attention to replace the red part on their own


Usage: under cmd


sping ip/hostname


sping.rar


14. treehtm


Enter the directory, layer by layer, annoying


The tree command is for only a look. D on't give some... I just want to order


The htm version of the tree command


htm, css have not done, now learned, master adulterous smile


Run at the root, test, save as tree_htm.cmd run


@echo off


del tree.htm 2>nul


The htm version of the echo tree command


echo.


echo by hitme 2005.7.3 [email protected]


echo.


Echo can be clicked directly into the 6-tier directory, perfectionists please modify their own


echo


echo.


echo Please wait...


>end.htm echo ^<head^>


>>end.htm echo ^<meta http-equiv="Content-Type" content="text/html^;


charset=gb2312" ^/^>


>>end.htm echo ^<style type="text/css"^>


>>end.htm echo ^<!--


>>end.htm echo a:active { text-decoration: none ; c olor: red ; f ont-


size: 12pt }


>>end.htm echo a:visited { text-decoration: none ; c olor: green ;


font-size: 12pt }


>>end.htm echo a:link { text-decoration: none ; f ont-size: 12pt }


>>end.htm echo --^>


>>end.htm echo ^</style^>


>>end.htm echo ^</head^>


>>end.htm echo ^<body^>


setlocal ENABLEDELAYEDEXPANSION


for /f "skip=2 delims=" %%i in ('tree') do (


set n=%%i


if "!n:~1,1!" " :" set n0=!n:~0,2!


if "!n:~1,1!" " ─" (set n1=!n:~2!


set n2


set n3


set n4


set n5


set n6


set n7=)


if "!n:~4,1!" "─" (set n2=!n:~5!


set n3


set n4


set n5


set n6


set n7=)


if "!n:~5,1!" "─" (set n2=!n:~6!


set n3


set n4


set n5


set n6


set n7=)


if "!n:~7,1!" "─" (set n3=!n:~8!


set n4


set n5


set n6


set n7=)


if "!n:~8,1!" "─" (set n3=!n:~9!


set n4


set n5


set n6


set n7=)


if "!n:~9,1!" "─" (set n3=!n:~10!


set n4


set n5


set n6


set n7=)


if "!n:~10,1!" "─" (set n4=!n:~11!


set n5


set n6


set n7=)


if "!n:~11,1!" "─" (set n4=!n:~12!


set n5


set n6


set n7=)


if "!n:~12,1!" "─" (set n4=!n:~13!


set n5


set n6


set n7=)


if "!n:~13,1!" "─" (set n5=!n:~14!


set n6


set n7=)


if "!n:~14,1!" "─" (set n5=!n:~15!


set n6


set n7=)


if "!n:~15,1!" "─" (set n5=!n:~16!


set n6


set n7=)


if "!n:~16,1!" "─" (set n5=!n:~17!


set n6


set n7=)


if "!n:~17,1!" "─" (set n6=!n:~18!)


if "!n:~18,1!" "─" (set n6=!n:~19!)


if "!n:~19,1!" "─" (set n6=!n:~20!)


if "!n:~20,1!" "─" (set n6=!n:~21!)


set n=!n: =^&nbsp;!


>>end.htm echo ^<a href="!n0!\!n1!\!n2!\!n3!\!n4!\!n5!\!n6!"


target="_blank"^>!n!^</a^>


>>end.htm echo ^</br^>


)


for /f "delims=" %%i in (end.htm) do (


set x=%%i


for /l %%a in (1,1,5) do (


set x=!x:\\=\!


)


echo !x!>>tree.htm


)


endlocal


del end.htm


start tree.htm


tree_htm.rar


15. wget


hxxp://www.sergeaura.net/TGP/001/images/01.jpg


...


hxxp://www.sergeaura.net/TGP/001/images/12.jpg


......


......


......


hxxp://www.sergeaura.net/TGP/162/images/01.jpg


...


hxxp://www.sergeaura.net/TGP/162/images/12.jpg


Run under curl cmd


curl -o #1_#2.jpg hxxp://www.sergeaura.net/TGP/[001-162]/images/[01-


12].jpg


wget+for...... J iuyang Shengong, the internal work part is slightly more complex, through 2 veins, the power of day-to-day progress. S ave


Run for get.cmd


setlocal ENABLEDELAYEDEXPANSION


for /l %%i in (1001,1,1162) do for /l %%j in (101,1,112) do @(


set s=%%i


set t=%%j


wget -O !s:~1,3!! t :~1,2!. J pg


hxxp://www.sergeaura.net/TGP/!s:~1,3!/images/!t:~1,2!.jpg)


endlocal


wget.zip


16.


for /r %I i n ( ..txt


Simple: tree /f


17. QQ 3


1. View QQ friends who haven't been in touch for a long time, and delete them easily, such as not talking to you for 3 months


Set the exported mixed chat history to qq .txt


-------------------------------------------


Findstr"message object: "qq.txt contact .txt


for /f "tokens-2 delims-()" %i in (contact.txt) do findstr "2004-0


7]-" qq.txt ^ | f ind "%i"|| T he results of echo %i and gt; results .txt


2. Extract msn contact email list to facilitate the import of mail sending and receiving software


Set the exported file to msn.ctt, and the list .csv as a result


for /f "tokens=3 delims=<>" %%i in (msn.ctt) do echo %%i >>list.csv


1, export the total conversation record


2, for maximum compatibility, copy qq .txt to the C root directory


3, run -CMD (XP) or windows 98 into the dos state


4, enter


Findstr"message object: "qq.txt contact .txt


Enter


5, enter


for /f "tokens-2 delims-()" %i in (contact.txt) do findstr "2004-0


7]-" qq.txt ^ | f ind "%i"|| T he results of echo %i and gt; results .txt


Enter


6, wait


Reference reply


18. 357


After dinner, mm asked me to toss a 35 pick 7 selector, to try luck, I was very lucky, bought


5, 6w, basically not more than 300, write things do not know the back


The idea is:


Construct a line of text with 1-35 numbers, one for each line, plus a random number of 3 digits


For example


234:1


214:2


523:3


...


Then sort this text, take the first 7 numbers, and finish


Old, two bottles of beer down, it's a little dizzy... I nterested in trying


Save to run as 35x7.cmd


@echo off


:start


del tmp.txt 2>nul


for /l %%i in (1,1,35) do (


setlocal ENABLEDELAYEDEXPANSION


for /l %%a in (1,1,3) do (


echo %random% >nul


set m=!m!! r andom:~-1!


)


echo !m!:%%i>>tmp.txt


endlocal


)


setlocal ENABLEDELAYEDEXPANSION


set /a num=0


for /f "tokens=2 delims=:" %%i in ('sort tmp.txt') do (


set n=%%i


set m=!m! !n!


set /a num=!num!+1


if !num! 7 echo This issue 35 pick 7 of the winning number is: !m: - 1! & amp;& goto :save


)


:save


set /p x - Reserved number to .txt s.


if /i [%x%] [y] (echo !m:~1!>>num.txt && endlocal && goto :start)


else (endlocal && goto :start)


35x7.rar


19.


Save to run in the xx.cmd document directory and run recovery again


@echo off


setlocal ENABLEDELAYEDEXPANSION


for /f "delims=" %%i in ('dir /s/b *.doc') do (


set n=%%~ni


set r_name=%%~ni


set t_name


for /l %%a in (1,1,100) do (


set n1=!n:~0,1!


set n=!n:~1!


set t_name=!n1!! t_name!


if "!n!" "" (


cd "%%~dpi"


ren "!r_name!. doc" "!t_name!. doc" 2>nul>nul


)


)


)


endlocal


xx.rar


20. htm-----CMD


This is the foundation... Simple in format, easy to construct


CMD is also convenient: Help Dir


Some people need to make an HTM manual to play


Save as cmd_help.cmd operation


@echo off


del net_cmd_help.htm 2>nul


echo.


echo...... Please wait, construct the HTM file .....


echo.


>cmd_help.htm echo ^<head^>


>>cmd_help.htm echo ^<title^>Help for Net commands^</title^>


>>cmd_help.htm echo ^<meta http-equiv="Content-Type"


content="text/html^; charset=gb2312" ^/^>


>>cmd_help.htm echo ^</head^>


>>cmd_help.htm echo ^<A NAME="Top"^>


>>cmd_help.htm echo ^<center^>


>>cmd_help.htm echo ^<h1^>CMD 命令速查手册^</h1^>


>>cmd_help.htm echo Written by Hitme


>>cmd_help.htm echo ^</center^>


>>cmd_help.htm echo ^<br^>


ver|find "Windows XP" && goto:joke


for /f "tokens=1*" %%i in ('help^|more +3') do (


help %%i>nul && echo ^<a href="#%%i"^>%%i^</a^>^&nbsp;^&nbsp;%%j


>>cmd_help.htm || echo ^&nbsp;^&nbsp;^&nbsp;^&nbsp; %%i


%%j>>cmd_help.htm


>>cmd_help.htm echo ^</br^>


)


for /f %%i in ('help^|more +3') do (


help %%i>nul && (


>>cmd_help.htm echo ^<a name="%%i"^>


>>cmd_help.htm echo ^<h2^>%%i^</h2^>


>>cmd_help.htm echo ^<pre^>


help %%i>>cmd_help.htm


>>cmd_help.htm echo ^</pre^>


>>cmd_help.htm echo ^<a href="#top"^>返回页首^</a^>


)


)


start cmd_help.htm


goto:eof


:joke


for /f "tokens=1*" %%i in ('help^|more +1') do (


help %%i>nul && echo ^&nbsp;^&nbsp;^&nbsp;^&nbsp; %%i


%%j>>cmd_help.htm || echo ^<a


href="#%%i"^>%%i^</a^>^&nbsp;^&nbsp;%%j >>cmd_help.htm


>>cmd_help.htm echo ^</br^>


)


for /f %%i in ('help^|more +1') do (


help %%i>nul || (


>>cmd_help.htm echo ^<a name="%%i"^>


>>cmd_help.htm echo ^<h2^>%%i^</h2^>


>>cmd_help.htm echo ^<pre^>


help %%i>>cmd_help.htm


>>cmd_help.htm echo ^</pre^>


>>cmd_help.htm echo ^<a href="#top"^>返回页首^</a^>


)


)


start cmd_help.htm


cmd_help.rar


21. htm-----Net


net /?


net view /help


View too annoying, tapping a manual to play


Save as Make.cmd


@echo off


del net_help.htm 2>nul


echo.


echo...... Please wait, construct the HTM file .....


echo.


setlocal ENABLEDELAYEDEXPANSION


for /f "tokens=1,2 delims=:" %%i in ('net help^|more +9^|findstr /n


"."') d o (


set n=%%j


if %%i gtr 0 (if %%i lss 10 (


echo !n:~3,22!>>tmp.txt


echo !n:~28,14!>>tmp.txt


echo !n:~50,14!>>tmp.txt


)


)


)


for /f "delims=" %%i in ('sort tmp.txt') do (


set x=%%i


set x=!x: =!


set x=!x:CONFIGWORKSTATION=CONFIG WORKSTATION!


set x=!x:CONFIGSERVER=CONFIG SERVER!


set x=!x:NET=NET !


echo !x!>>tmp1.txt


)


endlocal


>net_help.htm echo ^<head^>


>>net_help.htm echo ^<title^>Help for Net commands^</title^>


>>net_help.htm echo ^<meta http-equiv="Content-Type"


content="text/html^; charset=gb2312" ^/^>


>>net_help.htm echo ^</head^>


>>net_help.htm echo ^<A NAME="Top"^>


>>net_help.htm echo ^<center^>


>>net_help.htm echo ^<h1^>Net 命令速查手册^</h1^>


>>net_help.htm echo Written by Hitme


>>net_help.htm echo ^</center^>


for /f "delims=" %%i in (tmp1.txt) do (


>>net_help.htm echo ^<a href="#%%i"^>%%i^</a^>


>>net_help.htm echo ^</br^>


)


for /f "delims=" %%i in (tmp1.txt) do (


>>net_help.htm echo ^<a name="%%i"^>


>>net_help.htm echo ^<h2^>%%i^</h2^>


>>net_help.htm echo ^<pre^>


%%i /help|more /s>>net_help.htm


>>net_help.htm echo ^</pre^>


>>net_help.htm echo ^<a href="#top"^>返回页首^</a^>


)


del tmp*.txt


start net_help.htm


net_help.rar


make.rar


22. 297


@echo off


:start


setlocal ENABLEDELAYEDEXPANSION


:loop


del tmp.txt 2>nul


for /l %%i in (1,1,7) do (


echo %random% >nul


set /a m%%i=!random:~-1!+1


set /a m%%i=!m%%i!/4


set /a m%%i=!m%%i:~0,1!


echo %random% >nul


set /a n%%i=!random:~-1!


if !m%%i!! n%%i! 00 goto:loop


findstr /m "!m%%i!! n%%i!" tmp.txt 2>nul >nul && goto :loop


echo !m%%i!! n%%i!>>tmp.txt


)


endlocal


setlocal ENABLEDELAYEDEXPANSION


for /f %%i in ('sort tmp.txt') do (


set n=%%i


set m=!m! !n!


)


del tmp.txt


Cls


echo.


echo.¥100000000000000000000000000000000000000000.00


echo.


echo. Hitme, 29 selected 7 must, the number is! M!


echo.


echo.¥100000000000000000000000000000000000000000.00


echo.


set /p x - Reserved number to .txt s.


if /i [%x%] [y] (echo !m!>>num.txt && endlocal && goto :start) else


(endlocal && goto :start)


29x7.rar


23. 6+1


@echo off


setlocal ENABLEDELAYEDEXPANSION


Cls


del num.txt 2>nul


:loop


for /l %%i in (1,1,7) do (


echo %random% >nul


set n%%i=!random:~-1!


)


set num=%n1%%n2%%n3%%n4%%n5%%n6%%n7%


echo.


echo.***********************************


Echo Hitme, 6 + 1 must, the number is% NUM%


echo.***********************************


echo.


set /p x - Reserved number to .txt s.


if /i %x% y (echo %num%>>num.txt && goto :loop) else (goto :loop)


endlocal


6+1.rar


24.


@echo off


:start


setlocal ENABLEDELAYEDEXPANSION


:loop_a


del tmp*.txt 2>nul


for /l %%i in (1,1,6) do (


echo %random% >nul


set /a s%%i=!random:~-1!


echo %random% >nul


set /a g%%i=!random:~-1!


if "!s%%i!" "0" (set /a _VAR_=!g%%i! / 3) else (set /a


_VAR_=!s%%i!! g%%i! / 3)


if "!_VAR_:~1,1!" "" set _VAR_=0!_VAR_!


findstr /m "!_VAR_!" tmp.txt 2>nul >nul && goto :loop_a


if "!_VAR_!" "00" (echo 33>>tmp.txt) else (echo !_VAR_!>>tmp.txt)


)


sort tmp.txt>tmp1.txt


endlocal


:loop_b


setlocal ENABLEDELAYEDEXPANSION


echo %random% >nul


set /a s=!random:~-1!


echo %random% >nul


set /a g=!random:~-1!


if "!s!" "0" (set /a _VAR_=!g! / 6) else (set /a _VAR_=!s!! g! / 6)


if "!_VAR_:~1,1!" "" set _VAR_=0!_VAR_!


echo ^|>>tmp1.txt


if "!_VAR_!" "00" (echo 16>>tmp1.txt) else (echo !_VAR_!>>tmp1.txt)


endlocal


:echo


setlocal ENABLEDELAYEDEXPANSION


for /f %%i in (tmp1.txt) do (


set n=%%i


set m=!m! !n!


)


del tmp*.txt


Cls


echo.


echo.¥1000000000000000000000000000000000000000000.00


echo.


echo. Hitme, two-color ball must be in, the number is! M!


echo.


echo.¥1000000000000000000000000000000000000000000.00


echo.


:save


set /p x - Reserved number to .txt s.


if /i [%x%] [y] (echo !m!>>num.txt && endlocal && goto :start) else


(endlocal && goto :start)


ab.rar


25. &


for windows2000+


@echo off


:run


for /F "tokens=2" %%i in ('netstat -e ^| find "Bytes"') do set


down1=%%i


for /F "tokens=3" %%i in ('netstat -e ^| find "Bytes"') do set


up1=%%i


ping -w 850 -n 1 1.1.1.1 2>nul >nul


for /F "tokens=2" %%i in ('netstat -e ^| find "Bytes"') do set /a


down=(%%i-%down1%)/1024


for /F "tokens=3" %%i in ('netstat -e ^| find "Bytes"') do set /a


up=(%%i-%up1%)/1024


Cls


echo Down %down% KB


echo Up %up% KB


title %down% KB Down %up% KB Up


goto:run


--------------------------------------


@echo off


start /wait regedit /e tmp1.txt


"HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\"


for /f "tokens=3 delims=\:" %%i in ('find "\\DosDevices\\"


tmp1.txt') do echo %%i >>tmp2.txt


setlocal ENABLEDELAYEDEXPANSION


for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do find


"%%i" tmp2.txt 2>nul >nul|| s et n=!n!:,%%i


echo freedrv=!n:~2!


endlocal


pause


att-1.rar


26. TOP10


Features: List the latest directory name TOP10 for a specific directory


You can use the ftp login to display something recently updated, so you can easily crawl a specific directory to the most recently updated directory


Test


Usage, under cmd


t_ls /top number directory name


1, think if can't else, the original else (to bring an empty.)


2,%var:~n,m%


3,more +n| G et rid of the first few lines, hey, there's no more in the pipeline


4, setlocal ENABLEDELAYEDEXPANSION, in the for can be used tired "plus".


5,%var:string1-string2% replacement


6,!var! U sed in delayedexpansion


@echo off


Cls


echo.


echo..... L ist.... P lease wait less


echo.


if "%1" "" goto :syntax


if "%1" "/?" goto :syntax


if "%1" "/" goto :syntax


if "%1" "?" goto :syntax


if "%1" "/help" goto :syntax


setlocal ENABLEDELAYEDEXPANSION


:input


set n=%1


if "%n:~0,1%" "/" (


for /l %%i in (0,1,%n:~1%) do set var=!var! %%i:.


set m=%*


set m=!m:%n% =!) else (


for /l %%i in (0,1,10) do set var=!var! %%i:.


set m=%*


)


:head


(echo.^<head^>


echo.^<title^>列表目录下最新目录名TOP10^</title^>


echo.^<meta http-equiv="Content-Type" content="text/html^;


charset=gb2312" ^/^>


echo.^<style type="text/css"^>


echo.^<!--


echo.a:active { text-decoration: none ; color: red ; font-size: 12pt


}


echo.a:visited { text-decoration: none ; color: green ; font-size:


12pt }


echo.a:link { text-decoration: none ; font-size: 12pt }


echo.--^>


echo.^</style^>


echo.^</head^>


echo.^<h1^> 列表目录下最新目录名TOP10 ^</h1^>


echo. written by hitme 2005.9.3


echo.^</br^>)>list.htm


:list


for /f "delims=" %%i in ('dir "!m!\" /ad/b/tc/o-d^|more +0


') do (


(echo.-----------------------------------


echo.^</br^>


echo.^<a href="!m!\%%i"^>"!m!\%%i"^</a^>


echo.^</br^>


echo.^</br^>)>>list.htm


for /f "tokens=1-5* delims=: " %%a in ('dir "!m!\%%i"


/ad/tc/o-d^|more +5^|findstr /v /c:"<DIR> ." ^|findstr /n


"." ^|findstr /r /b "!var!"


') do (


if "%%f" neq "" (


>>list.htm echo.^<a href="!m!\%%i\%%f"^>%%a:


%%b %%c:%%d %%f^</a^>


>>list.htm echo.^</br^>)


)


)


start list.htm


endlocal


goto:eof


:syntax


Cls


echo.


echo. T _ls.cmd


echo.


echo.written by hitme 2005.9.3


echo.


Echo.Usage:


echo. t _ls /top number directory name


echo.


echo. For example:


echo. t _ls c:windows


echo. t _ls /20 c:


echo.


T_ls-1.rar


27.


renx.rar


28.


Today, the plate, forget to prepare the green / quasi-green program fast cut-off way, directory in and out is really annoying


Explorer search .exe, right-click drag out of the shortcut, by the non-entry exe interference, lost eyes ah


Find a way, find a way, cmd filter


Two strategies:


1, enumeration path, if there is an exe file under this layer path, does not go deep into the next layer


2, filter out the last visit time of the latest exe file, when it is the entrance bar, the eyes are our valuable knowledge


Power


Benefits of chance discovery:


1. Unearthed several pressure box bottoms of the East East


2. If it has a better classification, slightly change cmd, can also achieve the automatic classification of lnk


@echo off


echo.


echo.


echo. Shortcut to run out of the program in bulk.cmd by hitme 2005.5.11


echo.


echo. Wait a minute...


:P1


::***********************************************************


: # List path


:: # Filter 1: there is an estil file under the path


:: # Filter 1: Enumeration Path, IF There Is An Exe File Under this Layer Path, Does Not Go Deeper To The Next Layer


::***********************************************************


setlocal ENABLEDELAYEDEXPANSION


for /f "delims=" %%i in ('dir /s/b *.exe ^| findstr /v /i


"shortcut\.exe$"') do (


find "%%~dpi" tmp.txt>nul || (


echo %%~dpi | f ind "!n!" & gt;nul || (


echo %%~dpi>>tmp.txt


set n=%%~dpi


)


)


)


endlocal


:P2


::***********************************************************


:: # in the P1 path list as raw materials, Continue Processing


: # Make up the latest EXE file for the last access time


::***********************************************************


for /f "delims=" %%i in (tmp.txt) do (


dir /ta "%%i*.exe" | sort /r | findstr /n "." |


findstr /r "^1:">>tmp1.txt


)


:P3


::***********************************************************


: # 同行 合 合 P1, P2 => List.txt


::***********************************************************


set /a N1=0


for /f %%i in (tmp.txt) do set /a N1+=1


for /l %%a in (1,1,%N1%) do (


for /f "tokens=1* delims=:" %%i in ('findstr /n "." tmp.txt


^|findstr /r "^%%a:"') do set dir=%%j


for /f "tokens=3*" %%i in ('findstr /n "." tmp1.txt ^|findstr /r


"^%%a:"') do set filename=%%j


setlocal ENABLEDELAYEDEXPANSION


echo !dir!! filename!


echo !dir!! filename!>>list.txt


endlocal


)


:shortcut


::***********************************************************


: # Create a link in accordance with the list of list.txt paths


::***********************************************************


pause


for /f "delims=" %%i in (list.txt) do (


shortcut -d %%~dpi "%%i"


)


:clean


::***********************************************************


: # Clean your health


::***********************************************************


del tmp*.txt list.txt 2>nul


creat_shortcut.rar


29. n


Copy from Yesterday.vbs


I don't understand how to pass the VBS variable to the CMD variable, forget it, use


for... ('cscript.exe..).. Take it


Usage: CMD


del_day 5


Deleting file modification time is 5 days ago, test, delete operation is careful


@echo off


>t_day.vbs echo ' Yesterday.vbs, Version 1.01


>>t_day.vbs echo '


>>t_day.vbs echo ' Written by Rob van der Woude


>>t_day.vbs echo ' http://www.robvanderwoude.com


>>t_day.vbs echo '


>>t_day.vbs echo ' Calculate yesterday's date


>>t_day.vbs echo dtmYesterday = DateAdd("d",-%1,Date)


>>t_day.vbs echo '


>>t_day.vbs echo ' Get yesterday's year


>>t_day.vbs echo strYear = DatePart("yyyy",dtmYesterday)


>>t_day.vbs echo '


>>t_day.vbs echo ' Get yesterday's month, add leading zero if


necessary


>>t_day.vbs echo If DatePart("m",dtmYesterday) ^< 10 Then


>>t_day.vbs echo strMonth = 0 ^& DatePart("m",dtmYesterday)


>>t_day.vbs echo Else


>>t_day.vbs echo strMonth = DatePart("m",dtmYesterday)


>>t_day.vbs echo End If


>>t_day.vbs echo '


>>t_day.vbs echo ' Get yesterday's day, add leading zero if


necessary


>>t_day.vbs echo If DatePart("d",dtmYesterday) ^< 10 Then


>>t_day.vbs echo strDay = 0 ^& DatePart("d",dtmYesterday)


>>t_day.vbs echo Else


>>t_day.vbs echo strDay = DatePart("d",dtmYesterday)


>>t_day.vbs echo End If


>>t_day.vbs echo '


>>t_day.vbs echo ' Format output for yesterday


>>t_day.vbs echo strYest = strYear ^& strMonth ^& strDay


>>t_day.vbs echo '


>>t_day.vbs echo ' echo


>>t_day.vbs echo Wscript.echo( strYest )


@echo on


for /f "delims=" %%i in ('cscript.exe //nologo t_day.vbs') do set


t_day=%%i


setlocal ENABLEDELAYEDEXPANSION


for /r %%i in (*.*) do set c_day=%%~ti && if


"!c_day:~0,2!! c_day:~3,2!! c_day:~6,2!" lss "%t_day:~2,6%" del /q


"%%i"


endlocal


Cls


@echo


@echo is deleted.


@echo


30. “”


Take the star photo as an example; http://www.imagegarden.net/material/index.php? S


Save as .cmd operation, AlbumId from 595 to 2210


@echo off


set /a _n_=595


:loop


curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" -o


tmp.txt


http://www.imagegarden.net/viewimage.php?s=^&cataid=4^&albumid=2202^


&imageid=8^&type=jpeg


for /f "tokens=4 delims &" %%i in ('findstr


"cataid=4&albumid=2202&imageid=8&type=jpeg" tmp.txt') do (


set _session_=%%i


)


set /a _n_=%_n_%+1


if %_n_% 2210 goto :clean


md %_n_%


del /q *.jpg 2>nul


:dl


for /l %%a in (1,1,9) do (


curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" -o


%_n_%_00%%a.jpg


http://www.imagegarden.net/image_a.php?imagesession=%_session_%^&cat


aid=4^&albumid=%_n_%^&imageid=%%a^&type=jpeg


for %%i in (%_n_%_*.jpg) do (


if %%~zi 11527 (goto :loop) else move *.jpg %_n_%


)


)


for /l %%a in (10,1,99) do (


curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" -o


%_n_%_0%%a.jpg


http://www.imagegarden.net/image_a.php?imagesession=%_session_%^&cat


aid=4^&albumid=%_n_%^&imageid=%%a^&type=jpeg


for %%i in (%_n_%_*.jpg) do (


if %%~zi 11527 (goto :loop) else move *.jpg %_n_%


)


)


for /l %%a in (100,1,999) do (


curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" -o


%_n_%_%%a.jpg


http://www.imagegarden.net/image_a.php?imagesession=%_session_%^&cat


aid=4^&albumid=%_n_%^&imageid=%%a^&type=jpeg


for %%i in (%_n_%_*.jpg) do (


if %%~zi 11527 (goto :loop) else move *.jpg %_n_%


)


)


:clean


for /r %%i in (.) do rd /q "%%i"


del /q *.jpg


del /q tmp.txt


dl-1.rar


31.


Object:


http://www.sophoto.cn/photopost/showgallery.php?si=&perpage=24&sort


1&cat=501&ppuser


Goal: Get the picture url for easy flashget bulk download


Simply look at the next page: the connection has a large, medium and small figure, the scale of about 12 x 41


Ideas:


curl crawls 41 thumbnail pages and analyzes the thumbnail url


Because picture naming is regular, the difference between thumbnailing and graphing is the end


thumb .gif -thumb .jpg - thumbnail


.gif .jpg the big picture


med .jpg the middle image


This is easier, when crawling, replace some url content


Save as .cmd run


Curl is required


@echo off


curl -o #1.htm


http://www.sophoto.cn/photopost/showgallery.php?cat=501^&si=^&page=[


1-41]^&sort=1^&perpage=12^&password=0^&ppuser=^&what=^&name=^&


setlocal ENABLEDELAYEDEXPANSION


for /f "tokens=9 delims " %%i in ('findstr /r


"http://www\.sophoto\.cn/photopost/data/" *.htm') do (


set n=%%i


set n=!n:-thumb.gif" alt=.gif!


set n=!n:-thumb.jpg" alt=.jpg!


set n=!n:-thumb.jpeg" alt=.jpeg!


set n=!n:"=!


echo !n! & gt;>list.txt


)


endlocal


del *.htm


start list.txt


list.txt


32.


Download www.sky-fire.com more than 100 comics from the world


Mao estimates that there are hundreds of thousands of cartoon pictures


Curl is required


33.


Description: Download the daily http://www.wulffmorgenthaler.com/ in bulk


Pictures are in this format


http://www.wulffmorgenthaler.com/log/xxxxxxxxx.gif


Start:


1. Find the file name law, gif file name has two random bits, hit the wall


2. View the htm file


,http://www.wulffmorgenthaler.com/thestrip.asp?cDay=09&cMonth=05&cY


ear - 2005, with years and months, it's good to have regularity


3. List year and month, spare


4. Out of curl, download htm, analyze htm, download gif


5. Close the work


Save as get_gif.cmd run, modify the red section yourself, and now represent the gif file for the first 10 days of download


Curl is required


@echo off


::/ * list date */


set /a n=0


:loop


set /a n+=1


>t_day.vbs echo ' Yesterday.vbs, Version 1.01


>>t_day.vbs echo '


>>t_day.vbs echo ' Written by Rob van der Woude


>>t_day.vbs echo ' http://www.robvanderwoude.com


>>t_day.vbs echo '


>>t_day.vbs echo ' Calculate yesterday's date


>>t_day.vbs echo dtmYesterday = DateAdd("d",-%n%,Date)


>>t_day.vbs echo '


>>t_day.vbs echo ' Get yesterday's year


>>t_day.vbs echo strYear = DatePart("yyyy",dtmYesterday)


>>t_day.vbs echo '


>>t_day.vbs echo ' Get yesterday's month, add leading zero if


necessary


>>t_day.vbs echo If DatePart("m",dtmYesterday) ^< 10 Then


>>t_day.vbs echo strMonth = 0 ^& DatePart("m",dtmYesterday)


>>t_day.vbs echo Else


>>t_day.vbs echo strMonth = DatePart("m",dtmYesterday)


>>t_day.vbs echo End If


>>t_day.vbs echo '


>>t_day.vbs echo ' Get yesterday's day, add leading zero if


necessary


>>t_day.vbs echo If DatePart("d",dtmYesterday) ^< 10 Then


>>t_day.vbs echo strDay = 0 ^& DatePart("d",dtmYesterday)


>>t_day.vbs echo Else


>>t_day.vbs echo strDay = DatePart("d",dtmYesterday)


>>t_day.vbs echo End If


>>t_day.vbs echo '


>>t_day.vbs echo ' Format output for yesterday


>>t_day.vbs echo strYest = strYear ^& strMonth ^& strDay


>>t_day.vbs echo '


>>t_day.vbs echo ' echo


>>t_day.vbs echo Wscript.echo( strYest )


for /f "delims=" %%i in ('cscript.exe //nologo t_day.vbs') do echo


%%i>>tmp.txt


if %n% neq 10 goto :loop


::/ * get htm&gif * /


for /f "delims=" %%i in (tmp.txt) do (


setlocal ENABLEDELAYEDEXPANSION


set n=%%i


curl -o !n!. htm


http://www.wulffmorgenthaler.com/thestrip.asp?cDay=!n:~-


2!^&cMonth=!n:~4,2!^&cYear=!n:~0,4!


for /f "tokens=4 delims " %%j in ('findstr "log" *.htm') do (


set m=%%j


curl -o !m:~5,-5! http://www.wulffmorgenthaler.com/!m:~1,-5!


)


del *.htm


endlocal


)


::/ * clean * /


del tmp.txt


get_gif.rar


34.


7.9 Update, support scope download


http://automobile.2405.com/


The car pictures in this are good. I want to download all it all down.


Save it to DL.cmd operation


Curl is required


@echo off


setlocal ENABLEDELAYEDEXPANSION


for /f "tokens=2 delims " %%i in ('curl


http://automobile.2405.com/index.html ^|findstr


"automotive_catalog"') do (


set n=%%i


curl http://automobile.2405.com/!n:~1,-7! |findstr


"automobile_gallery" >tmp.txt


for /f "tokens=2 delims " %%a in (tmp.txt) do (


set m=%%a


curl http://automobile.2405.com/!m:~4,-7!/index.html |findstr "jpg"


>tmp1.txt


set x=!n:~1,-7!! m :~4,-7!


set x=!x:/=\!


md !x! 2 >nul


for /f "tokens=2 delims " %%b in (tmp1.txt) do (


set l=%%b


if not exist "!x!\!l:~1,-10!" curl -o "!x!\!l:~1,-10!"


http://automobile.2405.com/!m:~4,-7!!l:~1,-10!


)


)


)


endlocal


del tmp*.txt


dl.rar


35 .txt


Sometimes it's not convenient to go somewhere else first, then del, and want a little automation


under cmd


for /f "delims=/" %i in ('dir /b/s *.*') do dir /b/s *.txt | f ind


"%i" || d el "%i"


Need to keep the next few types?


Example: Keep txt rar


for /f "delims=/" %i in ('dir /b/s *.*') do dir /b/s *.txt *.rar|


find "%i" || d el "%i"


36.


Features: All shares of a host in the hook-up network (e.g. 192.168.1.99) are network drives


Usage: run mntshare under cmd /?


The output of net view s/ip is too bt


The list is wrong when the share name is too long, and the share name has spaces that make it difficult to crawl (field intervals are not skipping).


, but spaces)


is to turn it over...


Make a trick: Use the type Disk field positioning, turn the line of text over, replace it, and reverse it back.


Oh, insist, persistence is victory, test


By the way... N aked run cmd's text replacement ability is too meaty:


Think about it or eat enough support, xp after the system with automatic scanning, give 2000 a good one


@echo off


echo. Host %1 shared hook in...


del tmp.txt 2>nul


if "%1" "" goto :syntax


if "%1" "/?" goto :syntax


if "%1" "/" goto :syntax


if "%1" "?" goto :syntax


if "%1" "/help" goto :syntax


setlocal ENABLEDELAYEDEXPANSION


for /f "delims=" %%i in ('net view \\%1 ^|more +7') do (


set n=%%i


set r_n


for /l %%a in (1,1,40) do (


if "!n!" " " set n


set n1=!n:~0,1!


set n=!n:~1!


set r_n=!n1!! r _n!


)


set r_n=!r_n:*ksiD=!


echo !r_n!>>tmp.txt


)


for /f "tokens=*" %%j in (tmp.txt) do (


set m=%%j


set r_m


for /l %%b in (1,1,40) do (


if "!m!" " " net use * "\\%1\!r_m!" /persistent:yes 2>nul >nul


set m1=!m:~0,1!


set m=!m:~1!


set r_m=!m1!! r _m!


)


)


endlocal


Cls


echo.


echo.Hook host %1 share complete.


echo.


net use |more +5


pause


del tmp.txt 2>nul


explorer /e


:syntax


Cls


echo.


echo.mntshare.cmd hooks up the network sharing cmd script


echo.


echo.written by hitme 2005.8.16


echo.


Echo.Usage:


echo.mntshare ip or host name


echo.


echo. For example:


echo.mntshare 192.168.1.99


echo.mntshare mycomputer


echo.


echo.delete hook please use net use s /delete


echo.


pause


mntshare.rar


37. ()


Idle to be bored, fooling around with a simple network information collection


It is now included


1. IP and Mac Address corresponding table


2. IP and Hostname corresponding table


3. IP and Workgroup corresponding table


4. Query WHO is the master domain browser?


It's all based on nbtstat commands, playing around


@echo off


setlocal


:menu


Cls


mode con:cols=80 lines=25


Title Network Information Collection (Easy)


color f2


echo.


echo.***********************


echo. Network information collection (easy)


echo.***********************


Echo.1.ip and Mac Address correspondence table


echo.


ECHO.2.IP and Hostname


echo.


ECHO.3.IP and Workgroup


echo.


echo.


ECHO.4. Query WHO is a master domain browser?


echo.


echo.


Echo.x. Exit


echo.---------------------------------------------------------------


---


:input


SET / P x = Please select the project number:


if /i "%x%" "x" goto :end


echo.


SET / P Y = Please enter the IP range (for example: 192.168.1.1-254):


for /f "tokens=1-5 delims=.-" %%a in ("%y%") do (


set ip=%%a.%%b.%%c


set n1=%%d


set n2=%%e


)


if "%x%" "1" goto :mac


if "%x%" "2" goto :hostname


if "%x%" "3" goto :group


if "%x%" "4" goto :msbrowse


endlocal


::------------------------------------------------------------------


-----------


:mac


setlocal


Cls


mode con:cols=40 lines=40


color f4


Title IP and Mac Address correspondence table


echo. IP ^<=^> MAC Address's Table


echo.


(


echo. IP ^<=^> MAC Address's Table


echo.


) >mac.txt


for /l %%i in (%n1%,1,%n2%) do (


ping -n 1 -w 1 %ip%.%%i |find "Reply" >nul 2>nul && (


for /f "tokens=2 delims " %%a in ('nbtstat -a "%ip%"." %%i"^|findstr


/c:"MAC Address"') do (


echo.%ip%.%%i%%a


echo.%ip%.%%i%%a>>mac.txt


)


)


)


findstr /n "." mac.txt |findstr /r "^3:" && start mac.txt


endlocal


goto :menu


::------------------------------------------------------------------


----------


:hostname


setlocal


Cls


mode con:cols=40 lines=40


color f5


Title IP and Hostname


echo. IP ^<=^> Host_name's Table


echo.


(


echo. IP ^<=^> Host_name's Table


echo.


) >hostname.txt


for /l %%i in (%n1%,1,%n2%) do (


ping -n 1 -w 1 %ip%.%%i |find "Reply" >nul 2>nul && (


for /f %%b in ('nbtstat -a "%ip%"." %%i"^|findstr /r /c:"\<20\>


UNIQUE"') do (


echo.%ip%.%%i%%b


echo.%ip%.%%i%%b>>hostname.txt


)


)


)


findstr /n "." hostname.txt |findstr /r "^3:" && start hostname.txt


endlocal


goto :menu


::------------------------------------------------------------------


------------


:group


setlocal


Cls


mode con:cols=40 lines=40


color f1


Title IP and Workgroup Correspondeal


echo. IP ^<=^>Group Name's Table


echo.


(


echo. IP ^<=^>Group Name's Table


echo.


) >group.txt


for /l %%i in (%n1%,1,%n2%) do (


ping -n 1 -w 1 %ip%.%%i |find "Reply" >nul 2>nul && (


for /f %%c in ('nbtstat -a "%ip%"." %%i"^|findstr /r /c:"\<00\>


GROUP"') do (


echo.%ip%.%%i%%c


echo.%ip%.%%i%%c>>group.txt


)


)


)


findstr /n "." group.txt |findstr /r "^3:" && start group.txt


endlocal


goto :menu


:msbrowse


Cls


Title Query WHO is a master domain browser?


Echo. Inquiry .........


for /l %%i in (%n1%,1,%n2%) do (


ping -n 1 -w 1 %ip%.%%i |find "Reply" >nul 2>nul && (


nbtstat -a %ip%.%%i|findstr "__MSBROWSE__" 2>nul >nul && (


Echo. Master domain browser is:% IP%. %% i


pause


goto :menu


)


)


)


Cls


Echo. Not found ... Khan & Pause & Goto: Menu


:end


Cls


echo.


echo.written by hitme 2005.08.18


pause


goto :eof


net_Tab.rar


38. cmd


39.


I am bored, let one, test


Function: Counting the number of times each word appears in text


usage:


under cmd


Word_num file name


Statistical results:


0152 fixed


0108 added


0094 in


0091 to


0070 will


0069 not


0062 problem


0059 the


0056 bar


0054 support


0054 at


0053 and


0050 for


0047 menu


0046 tab


0042 when


0041 new


0040 option


0040 changed


0038 myie2


0037 plugin


0036 favorite


0035 toolbar


0035 on


Code


@echo off


Cls


echo.


echo.-----------------------------


echo.... Statistics ..... Please wait less ...


echo.-----------------------------


echo.


if "%*" "" goto :syntax


if "%*" "/?" goto :syntax


if "%*" "/" goto :syntax


if "%*" "?" goto :syntax


if /i "%*" "/help" goto :syntax


:: / * Disassembly text is a single word per line * /


setlocal ENABLEDELAYEDEXPANSION


del end.txt tmp*.txt 2>nul


set /a m=0


:loop


set /a m+=1


for /f "tokens=%m% delims=.,:;/[]()!' @=\<> " %%i in (%*) do (


set n=%%i


set n=!n:"=!


echo.1 !n!>>tmp.txt


)


if "%m%" "200" goto:add


goto:loop


endlocal


:add


:: /* Subtotals */


setlocal ENABLEDELAYEDEXPANSION


for /f "tokens=1,2" %%i in ('sort tmp.txt^|findstr /r "^1\ [a-z][A-


Z]"') do (


if /i "!y!" "%%j" (


set /a x+=1) else (if "!x!" neq "" (


if !x! lss 10 (echo.000!x! !y!>>tmp1.txt) else (


if !x! lss 100 (echo.00!x! !y!>>tmp1.txt) else (


if !x! lss 1000 (echo.0!x! !y!>>tmp1.txt))))


set y=%%j


set x=%%i)


)


if !x! lss 10 (echo.000!x! !y!>>tmp1.txt) else (


if !x! lss 100 (echo.00!x! !y!>>tmp1.txt) else (


if !x! lss 1000 (echo.0!x! !y!>>tmp1.txt)))


endlocal


sort /r tmp1.txt>tmp2.txt


:ex


:: / * Capital turn lowercase * /


setlocal ENABLEDELAYEDEXPANSION


for /f "delims=" %%i in (tmp2.txt) do (


set ex=%%i


set ex=!ex:A=a!


set ex=!ex:B=b!


set ex=!ex:C=c!


set ex=!ex:D=d!


set ex=!ex:E=e!


set ex=!ex:F=f!


set ex=!ex:G=g!


set ex=!ex:H=h!


set ex=!ex:I=i!


set ex=!ex:J=j!


set ex=!ex:K=k!


set ex=!ex:L=l!


set ex=!ex:M=m!


set ex=!ex:N=n!


set ex=!ex:O=o!


set ex=!ex:P=p!


set ex=!ex:Q=q!


set ex=!ex:R=r!


set ex=!ex:S=s!


set ex=!ex:T=t!


set ex=!ex:U=u!


set ex=!ex:V=v!


set ex=!ex:W=w!


set ex=!ex:X=x!


set ex=!ex:Y=y!


set ex=!ex:Z=z!


echo.! ex!>>end.txt


)


del tmp*.txt


start end.txt


:syntax


Cls


echo.


echo.word_num.cmd


echo.


echo.written by hitme 2005.9.2


Usage:


ECHO.WORD_NUM file name


echo.


echo. For example:


echo.word_num License.txt


echo.


Statistics, usage with the top floor, think


The way is in a vertical row, try


Code:


@echo off


setlocal ENABLEDELAYEDEXPANSION


for /f "delims=" %%i in (%1) do (


set n=%%i


echo.! n!>tmp.txt


echo.x>>tmp.txt


for /f "tokens=1 delims=:" %%a in ('findstr /o "x"


tmp.txt') do set lenth=%%a


for /l %%a in (0,1,!lenth!) do (


set m=!n:~%%a,1!


if "!m!" neq "" echo.1 !m!>>tmp1.txt


)


)


:add


for /f "tokens=1,2" %%i in ('sort tmp1.txt') do (


if "!y!" " %%j" (


set /a x+=1) else ( if "!x!" neq "" (


if !x! l ss 10 (echo.000!x!


!y!>>tmp2.txt) else (


if !x! l ss 100 (echo.00!x!


!y!>>tmp2.txt) else (


if !x! l ss 1000 (echo.0!x!


!y!>>tmp2.txt))))


set y=%%j


set x=%%i)


)


if !x! lss 10 (echo.000!x! !y!>>tmp2.txt) else (


if !x! lss 100 (echo.00!x! !y!>>tmp2.txt) else (


if !x! lss 1000 (echo.0!x! !y!>>tmp2.txt)))


endlocal


sort /r tmp2.txt>end.txt


del tmp*.txt


start end.txt


word_num.rar


40. sample


Set the source file to text .txt


To replace problem with hitme, the simplest replacement


Code:


setlocal ENABLEDELAYEDEXPANSION


for /f "delims=" %%i in (text.txt) do set n=%%i && set


m=!n:problem=hitme! & amp;& echo !m! & gt;>replace.txt


endlocal


start replace.txt


att-2.rar


41. usb&


Use with caution


devcon is very good, just recommend it


@echo off


for /f %%i in ('devcon findall ^=usb ^| find ":"') do devcon remove


"@%%i"


for /f %%i in ('devcon findall usb* ^| find ":"') do devcon remove


"@%%i"


devcon rescan


renew_usb.rar