China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-25 14:47
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [Help] Which is faster, LOCATE or DIR? View 1,243 Replies 2
Original Poster Posted 2003-01-16 00:00 ·  中国 北京 联通
初级用户
Credits 179
Posts 26
Joined 2002-12-10 00:00
23-year member
UID 467
Gender Male
Status Offline
I have a section of commands like this:
dir %gpath%*.gho /b /s >>%temp%\tmp.txt
I thought DIR was too slow, so I borrowed LOCATE from Yiyesong's boot disk and changed it to:
locate %gpath%*.gho /n >%temp%\tmp.txt
When this command is used by itself, it can find the GHOST image file on the specified drive, but why does it stop working when put into the command line above?
I'd appreciate it if some expert could point it out
Floor 2 Posted 2003-01-16 00:00 ·  美国 肯塔基州 费耶特县 列克星敦 Charter_Communications
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
What exactly do you mean by "not working"? I tried it, and it works.
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 3 Posted 2003-01-17 00:00 ·  中国 北京 联通
初级用户
Credits 179
Posts 26
Joined 2002-12-10 00:00
23-year member
UID 467
Gender Male
Status Offline
I may not have explained it clearly.
If I use dir d: *.gho /b /s >>%temp%\tmp.txt and locate d: *.gho /n >%temp%\tmp.txt,
the final results shown in tmp.txt are the same for both, just a simple line like "d:\backup\xppro.gho". I thought it had succeeded, so I put it on the disk, but in actual use the latter always tells me it can't find it. It made me furious, and then I manually entered the command locate d: *.gho under DOS, and it found it immediately. I don't understand what's going on.
Never mind, boss, I'll just paste the batch file here. Please help me see where the problem is.

@echo off
call pdos.bat
recur
cls
:main
call w.bat box @clone.bat:w_main
if errorlevel 100 goto exit
if errorlevel 4 goto exit
if errorlevel 3 goto ghost
if errorlevel 2 goto rec1

:bak1
set m=
set n=
call w.bat box @clone.bat:w_bak1
if errorlevel 100 goto main
if "%?%"=="5" goto main
if "%?%"=="4" goto bak_mn
if "%?%"=="3" goto bak_21
if "%?%"=="2" goto bak_12

:bak_11
set m=1
set n=1
goto bak2

:bak_12
set m=1
set n=2
goto bak2

:bak_21
set m=2
set n=1
goto bak2

:bak_mn
if "%m%"=="" goto bak1
if "%n%"=="" goto bak1

:bak2
call w.bat box @clone.bat:w_bak2
if errorlevel 100 goto bak1
if "%?%"=="7" goto bak1
if "%?%"=="6" goto bak_num
if "%?%"=="5" goto bak_700
if "%?%"=="4" goto bak_680
if "%?%"=="3" goto bak_650
if "%?%"=="2" goto bak_640

:bak_nos
call w.bat box @clone.bat:w_bak3
if errorlevel 100 goto bak2
if errorlevel 2 goto bak2
set gsize=0
goto bak3

:bak_640
set gsize=640
goto bak3

:bak_650
set gsize=650
goto bak3

:bak_680
set gsize=680
goto bak3

:bak_700
set gsize=700
goto bak3

:bak_num
if "%gsize%"=="" goto bak2
if "%gsize%"=="000" set gsize=0
if "%gsize%"=="00" set gsize=0
goto bak3

:bak3

echo :d_list " Save the GHO file in ">%temp%\tmp.txt
func -a6 >>%temp%\tmp.txt
call w.bat list @%temp%\tmp.txt:d_list
if errorlevel 100 goto bak2
if "%wbat%"=="" goto bak2
set gpath=%wbat%:\
goto bak4

:bak4
call w.bat box @clone.bat:w_bak4
if errorlevel 100 goto bak3
if "%?%"=="2" goto bak3
if "%gname%"=="" goto bak4

if exist %gpath%%gname%.GHO goto bak41
goto bak5

:bak41
call w.bat box @clone.bat:w_bak41 #2
if errorlevel 100 goto bak4
if errorlevel 2 goto bak4

:bak5
call w.bat box @clone.bat:w_bak5
if errorlevel 100 goto bak4
if errorlevel 4 goto bak4
if errorlevel 3 goto bak_z2
if errorlevel 2 goto bak_z1
set gzip=0
goto bak6

:bak_z1
set gzip=1
goto bak6

:bak_z2
set gzip=2
goto bak6

:bak6
call w.bat box @clone.bat:w_bak6
if errorlevel 100 goto bak5
if errorlevel 2 goto bak5

if "%gsize%"=="0" goto Dbak_ns
if "%gzip%"=="0" goto Dbak_nz

call quit
cls
ghost -sure -fx -auto -span -z%gzip% -split=%gsize% -clone,mode=pdump,src=%M%:%N%,dst=%gpath%%gname%.GHO
goto end

bak_nz
call quit
cls
ghost -sure -fx -auto -span -split=%gsize% -clone,mode=pdump,src=%M%:%N%,dst=%gpath%%gname%.GHO
goto end

bak_ns
if "%gzip%"=="0" goto Dbak_nsz
call quit
cls
ghost -sure -fx -z%gzip% -clone,mode=pdump,src=%M%:%N%,dst=%gpath%%gname%.GHO
goto end

bak_nsz
call quit
cls
ghost -sure -fx -clone,mode=pdump,src=%M%:%N%,dst=%gpath%%gname%.GHO
goto end

:rec1
set m=
set n=
call w.bat box @clone.bat:w_rec1
if errorlevel 100 goto main
if "%?%"=="5" goto main
if "%?%"=="4" goto rec_mn
if "%?%"=="3" goto rec_21
if "%?%"=="2" goto rec_12

:rec_11
set m=1
set n=1
goto rec2

:rec_12
set m=1
set n=2
goto rec2

:rec_21
set m=2
set n=1
goto rec2

:rec_mn
if "%m%"=="" goto rec1
if "%n%"=="" goto rec1

:rec2
echo :d_list " Select the drive where the GHO file is located ">%temp%\tmp.txt
func -a9 >>%temp%\tmp.txt
call w.bat list @%temp%\tmp.txt:d_list
if errorlevel 100 goto rec1
if "%wbat%"=="" goto rec1
set gpath=%wbat%:\

echo Searching %gpath%*.gho ...
echo :m_dir " Select the GHO file to restore " >%temp%\tmp.txt
locate %gpath%*.gho /n >%temp%\tmp.txt
call w.bat list @%temp%\tmp.txt:m_dir
if errorlevel 100 goto rec2
if "%wbat%"=="" goto rec2
set gfile=%wbat%

:rec3
set p=
call w.bat box @clone.bat:w_rec3
if errorlevel 100 goto rec2
if "%?%"=="3" goto rec2
if "%?%"=="2" goto rec_p

set p=1
goto rec4

:rec_p
if "%p%"=="" goto rec3

:rec4
set isOK=
call w.bat box @clone.bat:w_rec4
if errorlevel 100 goto rec3
if "%?%"=="2" goto rec3

if "%isOK%"=="OK" goto do_rec

goto rec4

:do_rec
call quit
ghost -sure -clone,mode=pload,src=%gfile%:%P%,dst=%M%:%N%
if errorlevel 1 goto exit

wbat box "Reboot Now?" Yes,No
if errorlevel 100 goto exit
if errorlevel 2 goto exit
reboot
goto end

:w_main " Enable Ghost "




::

:w_bak1 " Ghost backup wizard "





4. Back up partition on hard disk


::

:w_bak2 " Ghost backup wizard "

Back up partition %N% on hard disk %M%
======================================


Split backup:




Custom size: (note: numbers only)
MB


::

:w_bak3

Are you sure you want a backup without splitting?


::

:w_bak4 " Ghost backup wizard "

Split %gsize%MB, back up partition %N% on hard disk %M% to %gpath% (0MB means no split)
==========================================================================================

Enter GHO filename: .GHO

Note:
Please enter it correctly according to DOS filename rules. This program does not validate it. Do not enter .GHO.
::

:w_bak41

File %gpath%%gname%.GHO already exists. Overwrite it?


::

:w_bak5 " Ghost backup wizard "

Do you want to compress the backup file?


::

:w_bak6 " Ghost backup wizard "

Ready
==========

Compression level: %gzip% (0: no compression 1: fast compression 2: high compression)
Split %gsize%MB (0MB means no split)
Hard disk %M%
Partition %N%
Back up to %gpath%%gname%.GHO

Is the above information correct?
Before backing up, please make sure the capacity of the drive you selected is large enough.
Press the button to start backing up data.
Press the button to re-enter the information.


::

:w_rec1 " Ghost restore wizard "





4. Restore partition on hard disk


::

:w_rec3 " Ghost restore wizard "

Source file: %gfile%
Target: partition %N% on hard disk %M%



2. Restore from partition in the source file


::

:w_rec4 " Ghost restore wizard "

Ready
==========

Now preparing to restore partition %P%
from %gfile% to partition %N% on hard disk %M% of this computer!

Before this, please make sure the files in partition %N% on hard disk %M% have already been backed up!
Once the restore starts, all data in that partition will be overwritten and cannot be recovered!

Please enter uppercase OK and then press the button to begin restoring,
otherwise press the button to return.


::

:ghost
call quit
cls
ghost
goto end

:exit
call quit
cls

:end
set isOK=
set gfile=
set gname=
set gsize=
set gzip=
set gpath=
set m=
set n=
set p=
set ?=
set wbat=
if exist %temp%\tmp.txt del %temp%\tmp.txt


[ Last edited by willsort on 2005-10-13 at 10:51
Forum Jump: