Current location - Health Preservation Learning Network - Healthy weight loss - Ask everyone to process in batches.
Ask everyone to process in batches.
I admire most when I play batch processing 10. It was written by Germans with English comments (function: file replacement of batch processing system).

* Replacer 2.63 pre-release version

* www3.telus.net/_/replacer/

* Email :undefined@telus.net

@ Turn off echo

Title replacer

* check the operating system

ver | find "NT " >nul & amp& amp(

echo/! Windows NT is not supported.

Pause & gt null

Go: eof

)

set local disabled delayed expansion enable extensions

* Use existing components

If "%~dp0Components\* exists. exe "(

set " path = % ~ dp0Components%path% "

Title replacer *

)else(

set " path = % windir % \ system32%path% "

)

* Temporary directory

set "dir=%~dp0。 Replacement program "

* Use %tmp% for read-only media.

If "%dir%" MD "%dir%" 2 >; nul ||(

set "dir=%tmp%\。 Replacement program "

Md "%tmp%\ "ReplacerTemp "2> is empty.

)

* Flag used to communicate with other scripts

Set FLG = "%dir% \ ... flag _ safetodel"

set fl2="%dir%\.Flag2_SafeToDel "

* Extracted documents

set VBS = " % dir % \ Clear _ WFP _ message . VBS "

* Store rewritten scripts

Set "scr=%dir%". Current script "

* store the undo command in case the system can't start.

set und = " % windir % \ replace rundo . txt "

* store deleted files

set del = " % dir % \ deleted file _ SafeToDel "

Call: brake cleaning

Additional VBScript embedded at the bottom.

findstr/rc:"^[]" " % ~ dpnx 0 " & gt; % vbs % 2 & gtnul ||(

echo/! Unable to extract embedded file. Try using the component packages provided by the following websites:

echo/ %sys%

)

)

If pth is defined (

For%% * in (%sys%), do (

set sys = " % PTH % %~NX * "

)

)

Call: chk %sys% || (

Echo/ Press any key to continue.

Pause & gt null

Go to: System

)

* check whether the script is given as a system file.

For%% * in (%sys%), do (

if /i "%%~x*"== "。 txt "(

Find/me "; ; ReplacerScript " % % * & gtnul & amp& amp(

Call: scr %%*

)

)

)

Call: ver %sys% || goto:sys

: mod to get the replacement file

cls

Set "mod="

Echo/drag the replaced %nam% into this window.

If %bak% (

Echo/ or, type RESTORE to restore the backup of %nam%.

)

Then, press Enter to continue.

Echo/ or, type q to exit.

call:get mod || goto:mod

Call: quo mod

If /i %mod%=="Q "Call: brk Now

If /i %mod%=="RESTORE "(call: rst || goto:mod)

Call: chk %mod% || (

Echo/ Press any key to continue.

Pause & gt null

Go to: mode

)

if /i %mod%==%sys%(

echo/! The file cannot replace itself.

Echo/

Echo/ Press any key to continue.

Pause & gt null

)&&Go to: Mode

: cnf confirmation operation

cls

if %mod%==%bak%(

Echo/file will be resumed.

)else(

If %bak% (

Echo/File will not be backed up, the backup already exists.

)else(

For%% * in (%sys%), do (

The echo/ file will be backed up to:

echo/"%%~dpn*。 Backup "

)

)

)

Echo/

Echo/current file:

echo/%sys%

Echo/ will be replaced by:

echo/%mod%

Echo/

Echo/Continue? ^(Y/N^)

Call: get cnf || goto:cnf

Tel: quo cnf

If /i is not "%cnf:~ 1, 1%"=="Y", call: brk Now.

cls

: vbs starts VBScript.

* A flag tells VBScript when to quit, so WFP messages can still be used.

* cleared after Replacer.cmd exits.

If %flg% del %flg% exists,

If it is not "%atr%"=="non" (

start " "/below normal wscript//b % VBS % % flg % | |(

Echo/VBScript failed:

echo/%vbs%

Echo/

)

)

If "%scr%" exits /b

: rep replacement file

If %und% del/f %und% exists.

If there is no "%scr%" (

echo/ * %nam%:

)

* Overwrite system files with replacement files

if /i not %mod%==%bak%(

If %bak% (

Echo/-backup ...

Call: cpy %sys% %bak%

)

)

* Not all documents are protected.

If it is not "%atr%"=="non" (

If %dll% (

Echo/-Copy to DllCache ...

Call: cpy %mod% %dll%

)

If %spf% (

Echo/-copy to ServicePackFiles ...

Call: cpy %mod% %spf%

)

If there is %c86% (

Echo/-Compress to i386 folder ...

Call: cpy %mod% %fil%

Tel: cab %fil% %c86%

)

If there is %w86% (

Echo/-compressed to Windows i386 folder ...

Call: cpy %mod% %fil%

Tel: cab %fil% %w86%

)

If there is %d86% (

Echo/-Copy to Driver Cache ...

Call: cpy %mod% %d86%

)

)

if /i %mod%==%bak%(

Echo/-Recover system files ...

)else(

Echo/-Replace system files ...

)

* Simply renaming files bypasses WFP;;

:: "%~ 1"

If there is no "%pth%\%~nx 1" (

echo/! System file not found:

echo/ "%~ 1 "

Echo/

Exit /b 1

)

if /i not "%mod%"=="Restore "(

If "%mod%" does not exist (

echo/! Cannot find replacement file:

echo/ "%mod% "

Echo/

Exit /b 1

)

)

If it is not "%num %”= = =" "(

find/I ":\ \ % ~ n 1% num % " " % ~ F0 " & gt; nul 2 & gt& amp 1 || (

echo/! Invalid reference number:

echo/ "%~nx 1,%num% "

Echo/

Exit /b 1

)

)

Exit /b0

: opt handles optional lines (sys) in scripts.

If /i "%opt%"== "Optional" (

Echo: Replace the optional file "%~ 1"? ^(Y/N^)

setlocal enabledelayedexpansion

Call: get var

If/I "! var! ”=="Y "(

End local

Call: fmt "%system%,% modification%,% quantity%,% optimization%"

Exit /b

)else(

End local

)

)else(

Call: fmt "%system%,% modification%,% quantity%,% optimization%"

Exit /b 1

)

Exit /b0

: fmt format script

* If there is no token, please fill in the token.

set "var=%~ 1 "

set "var=%var:,,=,% "

set "var=%var:,,=,% "

& gt& gt" %scr%-tmp "echo /%var%

Exit /b0

: Sequence Run Sequence (4 ordered tokens)

* Used when replacing files in scripts.

Set "pth="

If it is not "%~ 3" = = ""(

Call: \\%~n 1%~3

)else(

Tel: scn% 1

)

Set "sys=%pth%%~nx 1"

if /i "%~2"=="Restore "(

Set "mod=%pth%%~n 1.backup"

)else(

Set "mod=%~f2"

)

Call: quo sys

Call: quo mod

Call: chk %sys% || exit/b

Call: chk %mod% || Exit /b

Call: version %sys% || Exit /b

Call: representative

Exit /b0

: scn scan folder

* When only the file name is given, find the most likely matching file.

:: (During script or system file entry)

Set "pth=%~ 1"

If it is not "%pth:\=%" == "%pth%" (

Set "pth=%~dp 1"

)else(

Set "pth="

Incoming call: \ \% ~ n102 > Nul & amp& amp exit /b0

* More common paths at the top.

For %%* in (

" %windir% "

" %windir%\system32 "

" %windir%\system32\drivers "

" %windir%\system "

" %programfiles%\Outlook Express "

" % program files % \ Windows Media Player "

" %windir%\Resources\Themes\Luna "

" %programfiles%\Movie Maker "

" %programfiles%\Windows NT "

" % windir % \ PCHEALTH \ help CTR \ Binaries "

" %windir%\Fonts "

" % program files % \ Internet Explorer "

"%program files% \ Internet Explorer \ Connection Wizard"

" % common program files % \ Microsoft Shared \ MSInfo "

" % program files % \ Windows NT \ Accessories "

" % program files % \ Windows NT \ Pinball "

" %commonprogramfiles%\System "

" %windir%\system32\Restore "

" % windir % \ system32 \ srchasst "

" %windir%\system32\usmt "

" % common program files % \ Microsoft Shared \ Speech "

" %programfiles%\NetMeeting "

" % common program files % \ System \ Mapi \ 1033 "

" % common program files % \ Adobe \ Calibration "

" % program files % \ Symantec \ live update "

" % program files % \ wild tangent \ Apps \ CDA "

" % program files % \ star dock \ Object Desktop \ icon packager "

) do (

If %fl2% (

If there is "%~ * \% ~ NX1"(

Set "pth=%%~*\"

Nul type & gt%fl2%

)

)

)

If %fl2% del %fl2% exists.

)

Exit /b0

: brk exits the replacement program ([Clear] [Immediately])

:: Cleanup and exit

If it is not "%~ 1"=="Purge" (

If it is not "%~ 1"==" now "(

Echo/

Echo/ Press any key to exit.

Pause & gt null

)

)

If /i not "%~ 1"=="Purge "If" %scr%" popd exists.

For%% * of (%vbs% %fil% %flg%)

% fl2 % " % SCR % " % del % " % SCR %-tmp " % DLP %

)do if exist % % * del/f % % * & gt; nul 2 & gt& amp 1

if /i not "%~ 1"=="Purge "(

If there is "%dir%" RD "%dir%" 2 >; empty

End local

* Use hard exit to prevent other loops from continuing.

export

)

Exit /b0

* List of special documents requiring more (or fewer) steps

: \ \ luna

Set "fln=luna.mst"

Set "atr=wfp"

Exit /b0

:\\Shellstyle

if/I not " % PTH:Homestead = % " = " % PTH % "(

Set "fln=home_ss.dll"

)

if/I not " % PTH:Metallic = % " = " % PTH % "(

Set "fln=metal_ss.dll"

)

if/I not " % PTH:normal color = % " = " % PTH % "(

Set "fln=blue_ss.dll"

)

if/I not " % PTH:\ system32 \ = % " = = " % PTH % "(

Set "fln=class_ss.dll"

)

Set "atr=wfp"

Exit /b0

:\\Marlett

Set "atr=non"

Exit /b

:\\Comctl32

if/I not " % PTH % " = " % windir % \ system32 \ "(

Set "atr=non"

)

Exit /b

:\\Commdlg

if/I not " % PTH % " = " % windir % \ system \ "(

Set "atr=non"

)

Exit /b

: \ \ Notepad

if/I not " % PTH % " = " % windir % \ "(

Set "atr=non"

)

Exit /b

:\\Uxtheme.dll

Set "atr=wfp"

:\\Comctl320

Set "pth=%windir%\system32"

Exit /b

:\\Comctl32 1

set " PTH = % windir % \ WinSxS \ x86 _ Microsoft。 windows . Common-Controls _ 6595 b 64 144 CCF 1df _ 6 . 0 . 0 . 0 _ x-ww _ 1382 d70a \ "

Exit /b

:\\Comctl322

set " PTH = % windir % \ WinSxS \ x86 _ Microsoft。 windows . Common-Controls _ 6595 b 64 144 CCF 1df _ 6 . 0 . 10.0 _ x-ww _ f7fb 5805 \ "

Exit /b

:\\Comctl323

set " PTH = % windir % \ WinSxS \ x86 _ Microsoft。 windows . Common-Controls _ 6595 b 64 144 CCF 1df _ 6 . 0 . 2600 . 133 1 _ x-ww _ 7 abf 6d 02 \ "

Exit /b

:\\Comctl324

set " PTH = % windir % \ WinSxS \ x86 _ Microsoft。 windows . Common-Controls _ 6595 b 64 144 CCF 1df _ 6 . 0 . 2600 . 15 15 _ x-ww _ 7 bb 98 b 8 a \ "

Exit /b

:\\Comctl325

set " PTH = % windir % \ WinSxS \ x86 _ Microsoft。 windows . Common-Controls _ 6595 b 64 144 CCF 1df _ 6 . 0 . 2600 . 2 180 _ x-ww _ a84f 1ff 9 \ "

Exit /b

:\\Commdlg0

Set "pth=%windir%\system"

Exit /b

:\\Commdlg 1

Set "pth=%windir%\system32"

Exit /b

: \ \ Notepad 0

Set "pth=%windir%\"

Exit /b

:\\Notepad 1

Set "pth=%windir%\system32"

Exit /b

:\\Shellstyle0

Set "pth=%windir%\system32"

Exit /b

:\\Shellstyle 1

Set "PTH =% windir% \ resources \ themes \ luna \ shell \ normal color"

Exit /b

:\\Shellstyle2

set " PTH = " % windir % \ Resources \ Themes \ Luna \ Shell \ Metallic \ "

Exit /b

:\\Shellstyle3

Set "PTH =% windir% \ resources \ themes \ luna \ shell \ homestead"

Exit /b

* List of script line formats

:\RNO

Set "mod=Restore"

Set Quantity =%~2

Set "opt=%~3"

Exit /b

:\R-O

Set "mod=Restore"

Set "Quantity ="

Set "opt=%~2"

Exit /b

:\RN-

Set "mod=Restore"

Set Quantity =%~2

Set "opt="

Exit /b

:\R -

Set "mod=Restore"

Set "Quantity ="

Set "opt="

Exit /b

:\-N-

Set "mod=%sys%"

Set "num=%~ 1"

Set "opt="

Exit /b

\-No.

Set "mod=%sys%"

Set "num=%~ 1"

Set "opt=%~2"

Exit /b

:\ - O

Set "mod=%sys%"

Set "Quantity ="

Set "opt=%~ 1"

Exit /b

:\M -

Set "mod=%~ 1"

Set "Quantity ="

Set "opt="

Exit /b

:\MN-

Set "mod=%~ 1"

Set Quantity =%~2

Set "opt="

Exit /b

:\M-O

Set "mod=%~ 1"

Set "Quantity ="

Set "opt=%~2"

Exit /b

:\MNO

Set "mod=%~ 1"

Set Quantity =%~2

Set "opt=%~3"

Exit /b

:\ -

Set "mod=%sys%"

Set "Quantity ="

Set "opt="

Exit /b

* Clear _ WFP _ message. VBS- clear WFP message.

Clear WFP message

Const win="Windows file protection "

Const wi2= "Unable to locate component"

set arg=wscript.arguments

If arg.count then

Flg = parameter item(0)

Else wscript.echo "bad parameter"

wscript.quit

If ... it will be over.

set w = wscript . createobject(" wscript . shell ")

set f = wscript . createobject(" scripting . file system object ")

x=999

And x>0.

If w.appactivate(win), then

w . sendkeys“{ ESC }”

w . sendkeys“{ TAB } { ENTER }”

If ... it will be over.

If w.appactivate(wi2), then

w . sendkeys“{ ESC } { TAB } { ENTER }”

If ... it will be over.

If f. file exists (flg), then

x=45

F. Delete file (flg)

If ... it will be over.

wscript.sleep 333

x=x- 1

line