Article View: comp.os.ms-windows.misc
Article #3418Re: Windows DOS box is lying to me
From: Ian Hobson
Date: Tue, 13 Dec 1994 00:06
Date: Tue, 13 Dec 1994 00:06
41 lines
2234 bytes
2234 bytes
In article <787141964snz@azmi.demon.co.uk>
azmi@azmi.demon.co.uk "Azmi Tenikalp" writes:
> To test for the existence of a directory from a DOS batch batch file,
> I use the time honoured method of testing for the existence of NUL
> in that directory, eg :
>
> if exist dir_name\nul goto blah_blah_blah
>
> I'm at present working on a batch file, in which the above works
> perfectly well running in DOS, but when I run it in a DOS box within
> Windows, it reports that the directory exists every time, whether the
> directory actually exists or not.
>
This is a bug in WFWG, and has caused me a little grief.
Best I could do was this approach.
@echo off
set A=N
for %%x in (%1\*.*) do set A=Y
if %A%.==N. goto notexist
echo %1 does exist
goto end
:notexist
echo %1 does not exist
:end
set A=
It is unfortunatly incorrect, in that it thinks empty directories
do not exist! Otherwise it works OK. Note that the = character
in the last line must be followed by a newline (CR, LF) and not
left as the last character in the file, or A will be "cleared"
to random junk.
If this doesn't meet your needs, you may need to write a little
program to do what you want, or use a shareware batch enhancer.
--
Ian Hobson ian@rmcsg.demon.co.uk | +44 (0) 246 553 644
No sig. Given them up.
Technical Details
Message-ID:
<787277218snz@rmcsg.demon.co.uk>Path:
arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!rutgers!sgigate.sgi.com!sgiblab!swrinde!howland.reston.ans.net!news.sprintlink.net!pipex!demon!rmcsg.demon.co.uk!IanReferences:
<787141964snz@azmi.demon.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1036bc,9ff9719c69a20c16 X-Google-Attributes: gid1036bc,public X-Google-Thread: 1102f1,9ff9719c69a20c16 X-Google-Attributes: gid1102f1,public X-Google-ArrivalTime: 1994-12-12 16:06:58 PST Newsgroups: comp.os.ms-windows.misc,demon.tech.pc From: Ian@rmcsg.demon.co.uk (Ian Hobson) Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!rutgers!sgigate.sgi.com!sgiblab!swrinde!howland.reston.ans.net!news.sprintlink.net!pipex!demon!rmcsg.demon.co.uk!Ian Subject: Re: Windows DOS box is lying to me References: <787141964snz@azmi.demon.co.uk> Organization: Home Reply-To: ian@rmcsg.demon.co.uk X-Newsreader: Demon Internet Simple News v1.29 Lines: 41 X-Posting-Host: rmcsg.demon.co.uk Date: Tue, 13 Dec 1994 00:06:58 +0000 Message-ID: <787277218snz@rmcsg.demon.co.uk> Sender: usenet@demon.co.uk