Sign in with
Sign up | Sign in
Your question

.BAT question

Tags:
  • Microsoft
  • Windows
Last response: in Windows 95/98/ME
Share
February 23, 2005 11:56:35 AM

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

More about : bat question

Anonymous
February 23, 2005 5:41:05 PM

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
Anonymous
February 24, 2005 12:19:46 AM

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
February 24, 2005 1:09:18 AM

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
>
>
!