MS-DOS

Moderators: blip
Number of threads: 389
Number of posts: 904

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
need some help on batchfile (windows 98 pure dos) Posted by jtan2000 on 29 Jul 2012 at 7:16 PM



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. 
echo * Ghost file %ghofile% at drive %drive%
echo * check if disk:volume %drive2% match the table above else
input " * type the correct disk:volume = " drive2 /E /L4
echo. 

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


Thread Tree
jtan2000 need some help on batchfile (windows 98 pure dos) on 29 Jul 2012 at 7:16 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.