.BAT question

Archived from groups: microsoft.public.win98.gen_discussion (More info?)

I've been working on a cloning (backup) scheme using a BAT file but would like to confirm existance of a 'drive' before launching a
utility. For example, Win98se is on drive-G. All that exist in the ROOT of drive-G is directories (no files). In a BAT file I can
use the following to confirm the existance of a drive WITH files in the root:

if exist C:\*.* clone (bla bla bla) <<< --- this works

When a drive does NOT have FILES in the root the 'if exist' statement will not work. Drive-G (Win98 drive) does NOT have files in
the root (only directories) so the statement below will not work:

if exist G:\*.* clone (bla bla bla) <<< --- does not work

Does anyone how to confirm a drives existance using BAT syntax with no files in the drive root, OR without calling a specific
directory? (e.g. if exist g:\windows\*.* clone) <-- don't want to do this

TIA,
Vic
3 answers Last reply
More about question
  1. Archived from groups: microsoft.public.win98.gen_discussion (More info?)

    "Vic" <nospam@bogusaddress.com> wrote in
    news:eudN#9aGFHA.1740@TK2MSFTNGP09.phx.gbl:

    > I've been working on a cloning (backup) scheme using a BAT file but
    > would like to confirm existance of a 'drive' before launching a
    > utility. For example, Win98se is on drive-G. All that exist in the
    > ROOT of drive-G is directories (no files). In a BAT file I can use the
    > following to confirm the existance of a drive WITH files in the root:
    >
    > if exist C:\*.* clone (bla bla bla) <<< --- this works
    >
    > When a drive does NOT have FILES in the root the 'if exist' statement
    > will not work. Drive-G (Win98 drive) does NOT have files in the root
    > (only directories) so the statement below will not work:
    >
    > if exist G:\*.* clone (bla bla bla) <<< --- does not work
    >
    > Does anyone how to confirm a drives existance using BAT syntax with no
    > files in the drive root, OR without calling a specific directory?
    > (e.g. if exist g:\windows\*.* clone) <-- don't want to do this
    >
    > TIA,
    > Vic
    >
    >
    >

    @echo off
    subst G: C:\ >nul
    if errorlevel 1 goto Exist
    echo G: doesn't exist
    goto End
    :Exist
    subst /D G:
    echo G: exists
    :End
  2. Archived from groups: microsoft.public.win98.gen_discussion (More info?)

    "Vic" <nospam@bogusaddress.com> wrote in message news:eudN%239aGFHA.1740@TK2MSFTNGP09.phx.gbl...

    > Does anyone how to confirm a drives existance using BAT syntax with no files in the drive root, OR without calling a specific
    > directory? (e.g. if exist g:\windows\*.* clone) <-- don't want to do this

    The NUL device ("file") is found on all existing drives, so
    if exist g:\NUL clone
  3. Archived from groups: microsoft.public.win98.gen_discussion (More info?)

    The NUL device works perfectly. I also learned some about using the SUBST command. Thanks to both for your responses!

    Vic
    ___
    "Vic" <nospam@bogusaddress.com> wrote in message news:eudN#9aGFHA.1740@TK2MSFTNGP09.phx.gbl...
    > I've been working on a cloning (backup) scheme using a BAT file but would like to confirm existance of a 'drive' before launching
    a
    > utility. For example, Win98se is on drive-G. All that exist in the ROOT of drive-G is directories (no files). In a BAT file I can
    > use the following to confirm the existance of a drive WITH files in the root:
    >
    > if exist C:\*.* clone (bla bla bla) <<< --- this works
    >
    > When a drive does NOT have FILES in the root the 'if exist' statement will not work. Drive-G (Win98 drive) does NOT have files in
    > the root (only directories) so the statement below will not work:
    >
    > if exist G:\*.* clone (bla bla bla) <<< --- does not work
    >
    > Does anyone how to confirm a drives existance using BAT syntax with no files in the drive root, OR without calling a specific
    > directory? (e.g. if exist g:\windows\*.* clone) <-- don't want to do this
    >
    > TIA,
    > Vic
    >
    >
Ask a new question

Read More

Microsoft Windows