假设你原先在D E F 。。。。Z中作了GHOST备份,后来忘记在哪些盘了,但只想找到第一个备份更新备份一次就结束了。
假如更新备份的命令是这样:
@echo off
Ghost.exe -CLONE,MODE=PDUMP,SRC=1:1,DST=WIN.gho -Z9 -sure -fx
bfyz.bat
如果找到多少就处理多少,如下就行了:
适合2000 XP 2003:
@echo off
for %%1 in (d e f ....z) do Ghost.exe -CLONE,MODE=PDUMP,SRC=1:1,DST=%%1:\WIN.gho -Z9 -sure -fx && bfyz.bat
适合98:
(很遗憾,现在只能分开ghost...... 和bfyz.bat这两个任务。在98中我未找到把这两个任务放在一起的方法,如有人能解决就赶快发贴吧!!
@echo off
for %%1 in (d e f ....z) do Ghost.exe -CLONE,MODE=PDUMP,SRC=1:1,DST=%%1:\WIN.gho -Z9 -sure -fx
for %%1 in (d e f ....z) do if exist %%1:\win.gho bfyz.bat
如果是找到第一个处理完就结束的话,如下:
@echo off
for %%1 in (z y x ....... d) do if exist %%1:\win.gho set vol=%%1
Ghost.exe -CLONE,MODE=PDUMP,SRC=1:1,DST=%vol%:\WIN.gho -Z9 -sure -fx
bfyz.bat
======================================
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
& &
& 有兴趣的话,可以耍一耍手动输入实参的DIY乐趣吧! &
& &
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
可以编个简单批处理实验一下,先在你最后两个盘 的根目录里编一个内容分别为“dddddddddddddddddddddd”和“eeeeeeeeeeeeeeeeeeeeee”的文件,都名为"target.txt".
======================
编个名为“oneput.bat”的批处理如下:
(一次性手动输入)
@echo off
:loop
shift
if %1#==# goto end
if not exist %1:\target.txt goto loop
dir %1:\target.txt
type %1:\target.txt
:end
操作时,键入
oneput d d e f g h i j k l m n o p q r s t u v w x y z回车。(要多输入一个任意字符,因为shift会作废第一个,就相当于在它前面有过一次%1)
=========================
再编个名为“everyput.bat”的批处理:
(看起来有点可怕!如有人能找到简洁的办法,就发贴吧!期待!。。。正为此严重郁闷中!)
(互动式手动输入) 其实这是假想的,因为一般没有这么多盘,所以只要依你的盘数编就行了。
@echo off
:loop
if exist %vol%:\target.txt goto end
choice /c:defghijklmnopqrstuvwxyz /t:d,99 enter a drive letter
set vol=z
if errorlevel 23 goto loop
set vol=y
if errorlevel 22 goto loop
set vol=x
if errorlevel 21 goto loop
set vol=w
if errorlevel 20 goto loop
set vol=v
if errorlevel 19 goto loop
set vol=u
if errorlevel 18 goto loop
set vol=t
if errorlevel 17 goto loop
set vol=s
if errorlevel 16 goto loop
set vol=r
if errorlevel 15 goto loop
set vol=q
if errorlevel 14 goto loop
set vol=p
if errorlevel 13 goto loop
set vol=o
if errorlevel 12 goto loop
set vol=n
if errorlevel 11 goto loop
set vol=m
if errorlevel 10 goto loop
set vol=l
if errorlevel 9 goto loop
set vol=k
if errorlevel 8 goto loop
set vol=j
if errorlevel 7 goto loop
set vol=i
if errorlevel 6 goto loop
set vol=h
if errorlevel 5 goto loop
set vol=g
if errorlevel 4 goto loop
set vol=f
if errorlevel 3 goto loop
set vol=e
if errorlevel 2 goto loop
set vol=d
if errorlevel 1 goto loop
:end
dir %vol%:\target.txt
type %vol%:\target.txt
echo It''''s done!
操作时,键入:
everyput d回车(每次输入一个:d......................z,直到出现“It''''s done! ”)
Suppose you originally made GHOST backups on drives D, E, F... Z, but then forgot on which drives, but you just want to find the first backup and update it once and be done.
Suppose the command to update the backup is like this:
@echo off
Ghost.exe -CLONE,MODE=PDUMP,SRC=1:1,DST=WIN.gho -Z9 -sure -fx
bfyz.bat
If you find how many, just handle how many, as follows:
Suitable for 2000, XP, 2003:
@echo off
for %%1 in (d e f ....z) do Ghost.exe -CLONE,MODE=PDUMP,SRC=1:1,DST=%%1:\WIN.gho -Z9 -sure -fx && bfyz.bat
Suitable for 98:
(Unfortunately, now I can only separate the ghost...... and the two tasks of bfyz.bat. In 98, I haven't found a way to put these two tasks together. If someone can solve it, hurry up and post it in the post bar!!
@echo off
for %%1 in (d e f ....z) do Ghost.exe -CLONE,MODE=PDUMP,SRC=1:1,DST=%%1:\WIN.gho -Z9 -sure -fx
for %%1 in (d e f ....z) do if exist %%1:\win.gho bfyz.bat
If it is to find the first one and finish processing it, it is as follows:
@echo off
for %%1 in (z y x ....... d) do if exist %%1:\win.gho set vol=%%1
Ghost.exe -CLONE,MODE=PDUMP,SRC=1:1,DST=%vol%:\WIN.gho -Z9 -sure -fx
bfyz.bat
======================================
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
& &
& If you are interested, you can have fun with DIY by manually entering actual parameters! &
& &
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
You can compile a simple batch processing to experiment. First, create files with contents "dddddddddddddddddddddd" and "eeeeeeeeeeeeeeeeeeeeee" respectively in the root directories of your last two drives, both named "target.txt".
======================
Compile a batch processing named "oneput.bat" as follows:
(One-time manual input)
@echo off
:loop
shift
if %1#==# goto end
if not exist %1:\target.txt goto loop
dir %1:\target.txt
type %1:\target.txt
:end
When operating, type
oneput d d e f g h i j k l m n o p q r s t u v w x y z and press Enter. (You need to enter one more arbitrary character, because shift will invalidate the first one, which is equivalent to having had a %1 in front of it)
=========================
Then compile a batch processing named "everyput.bat":
(Looks a bit scary! If someone can find a concise way, post it in the post bar! Looking forward to it! ... Seriously depressed about this!)
(Interactive manual input) Actually, this is hypothetical, because generally there are not so many drives, so just compile it according to your number of drives.
@echo off
:loop
if exist %vol%:\target.txt goto end
choice /c:defghijklmnopqrstuvwxyz /t:d,99 enter a drive letter
set vol=z
if errorlevel 23 goto loop
set vol=y
if errorlevel 22 goto loop
set vol=x
if errorlevel 21 goto loop
set vol=w
if errorlevel 20 goto loop
set vol=v
if errorlevel 19 goto loop
set vol=u
if errorlevel 18 goto loop
set vol=t
if errorlevel 17 goto loop
set vol=s
if errorlevel 16 goto loop
set vol=r
if errorlevel 15 goto loop
set vol=q
if errorlevel 14 goto loop
set vol=p
if errorlevel 13 goto loop
set vol=o
if errorlevel 12 goto loop
set vol=n
if errorlevel 11 goto loop
set vol=m
if errorlevel 10 goto loop
set vol=l
if errorlevel 9 goto loop
set vol=k
if errorlevel 8 goto loop
set vol=j
if errorlevel 7 goto loop
set vol=i
if errorlevel 6 goto loop
set vol=h
if errorlevel 5 goto loop
set vol=g
if errorlevel 4 goto loop
set vol=f
if errorlevel 3 goto loop
set vol=e
if errorlevel 2 goto loop
set vol=d
if errorlevel 1 goto loop
:end
dir %vol%:\target.txt
type %vol%:\target.txt
echo It''''s done!
When operating, type:
everyput d and press Enter (each time enter one: d......................z, until "It''''s done! " appears)