Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

need some help on batchfile (windows 98 pure dos)

jtan2000jtan2000 Posts: 2Member



Hi I have this batch running on pure dos. However it is not able to search to all directory and subfolder.
I do not know how to program it to seach recursively to find *.gho.

Greatly appreciate if someone can help me on the code.

Thank you.


set drive=
if exist E:*.gho set drive=E:
if exist F:*.gho set drive=F:
if exist G:*.gho set drive=G:
if exist H:*.gho set drive=H:
if exist I:*.gho set drive=I:
if exist J:*.gho set drive=J:
if exist K:*.gho set drive=K:
if exist L:*.gho set drive=L:
if exist M:*.gho set drive=M:
if exist N:*.gho set drive=N:
if exist O:*.gho set drive=O:
if exist P:*.gho set drive=P:
if exist Q:*.gho set drive=Q:
if exist R:*.gho set drive=R:
if exist S:*.gho set drive=S:
if exist T:*.gho set drive=T:
if exist U:*.gho set drive=U:
if exist V:*.gho set drive=V:
if exist W:*.gho set drive=W:
if exist X:*.gho set drive=X:
if exist Y:*.gho set drive=Y:
if exist Z:*.gho set drive=Z:

%drive%
FOR %%l IN (*.gho) do set ghofile=%%l





batch file ===================================


@echo off

rem booting from usb

rem usb stick hd1,1 -- assign c
rem hd c hd2,1 -- assign d
rem hd d hd2,2 -- assign e
rem hd e hd2,3 -- assign f

path a:

rem Check drives for existence of .gho file and return drive letter

set drive=
if exist E:*.gho set drive=E:
if exist F:*.gho set drive=F:
if exist G:*.gho set drive=G:
if exist H:*.gho set drive=H:
if exist I:*.gho set drive=I:
if exist J:*.gho set drive=J:
if exist K:*.gho set drive=K:
if exist L:*.gho set drive=L:
if exist M:*.gho set drive=M:
if exist N:*.gho set drive=N:
if exist O:*.gho set drive=O:
if exist P:*.gho set drive=P:
if exist Q:*.gho set drive=Q:
if exist R:*.gho set drive=R:
if exist S:*.gho set drive=S:
if exist T:*.gho set drive=T:
if exist U:*.gho set drive=U:
if exist V:*.gho set drive=V:
if exist W:*.gho set drive=W:
if exist X:*.gho set drive=X:
if exist Y:*.gho set drive=Y:
if exist Z:*.gho set drive=Z:


%drive% <------------------------------
FOR %%l IN (*.gho) do set ghofile=%%l <---------------------------

set drive2=
if exist E:*.gho set drive2=2:2
if exist F:*.gho set drive2=2:3
if exist G:*.gho set drive2=2:4
if exist H:*.gho set drive2=2:5
if exist I:*.gho set drive2=2:6
if exist J:*.gho set drive2=2:7
if exist K:*.gho set drive2=2:8
if exist L:*.gho set drive2=2:9
if exist M:*.gho set drive2=2:10
if exist N:*.gho set drive2=2:11
if exist O:*.gho set drive2=2:12
if exist P:*.gho set drive2=2:13
if exist Q:*.gho set drive2=2:14
if exist R:*.gho set drive2=2:15
if exist S:*.gho set drive2=2:16
if exist T:*.gho set drive2=2:17
if exist U:*.gho set drive2=2:18
if exist V:*.gho set drive2=2:19
if exist W:*.gho set drive2=2:20
if exist X:*.gho set drive2=2:21
if exist Y:*.gho set drive2=2:22
if exist Z:*.gho set drive2=2:23


echo. [0;32;40m
echo * Ghost file [1;33;40m%ghofile%[0;32;40m at drive [1;33;40m%drive%[0;32;40m
echo * check if disk:volume [1;33;40m%drive2%[0;32;40m match the table above else[1;33;40m
input " * type the correct disk:volume = " drive2 /E /L4
echo. [0m

if exist e:windows GOTO part2

echo ghost.exe -CLONE,MODE=PLOAD,SRC=%drive2%%ghofile%:1,DST=2:1 -FX
pause
ghost.exe -CLONE,MODE=PLOAD,SRC=%drive2%%ghofile%:1,DST=2:1 -FX
goto done

:part2

echo ghost.exe -CLONE,MODE=PLOAD,SRC=%drive2%%ghofile%:1,DST=2:2 -FX
pause
ghost.exe -CLONE,MODE=PLOAD,SRC=%drive2%%ghofile%:1,DST=2:2 -FX
:done
restart





========================================

also how can i modify code to search through all root directory to find *.gho ?

Thank you.



set %ghofile= [ Cannot locate ghost file ]

FOR /R %%l IN (*.gho) do set ghofile=%%l


@echo off
echo ghost file = %ghofile%


pause


Sign In or Register to comment.