Re: Syntax about DOS batch script

From: G (G@G.com)
Date: 04/17/02


From: "G" <G@G.com>
Date: Wed, 17 Apr 2002 11:37:01 GMT

Tony - DOS doesn't support the IF THEN ELSE like visual basic. If you want
that functionality, look at Windows Scripting Host at
http://msdn.microsoft.com/scripting

The same functionality exists with this logic however:

rem see if a file exists

if exist c:\boot.ini goto exists

goto doesntexist

:exists

echo file exists

goto done

:doesntexist

echo file doesn't exist

goto done

:done

Hope this helps!

Geoff

"tony" <tony@extranc.com> wrote in message
news:ubopeub3o2aq97@corp.supernews.com...
> Hi:
>
> i'm working on a script and i need to know
> if the certain folder exists in my win2000 file
> system or not to take the action. Is there
> way and syntax to tell the file/folder exist?
>
> ex:
> if (file/folder) then
> xxxxx
> else
> xxxxx
> end;
>
> Truly appreciated for the time and effort!
>
> tony
>
>
>
>



Relevant Pages

  • Re: regarding "goto" in C
    ... >> and security by hiding details while increasing the maintenceability ... >> and decreasing the time needed to debug the functionality. ... we have avoided the evil goto. ... You can waffle about design all you want, but this is code at the most ...
    (comp.lang.c)
  • Re: Same Batch file paused on some PC but not all
    ... last line they execute? ... if NOT %errorlevel%==1 goto file_not_match ... echo File not match, W2KSP4_tw.exe ... > goto CHKPT2 ...
    (microsoft.public.win2000.general)
  • Re: If exist batch command not working in WinXp
    ... Post the batch file here. ... goto end ... echo file not exists ... The only way I can think of to test whether a directory is empty is ...
    (microsoft.public.windowsxp.newusers)
  • Re: Question about Class Helpers
    ... In a highly typed language the "absolute" functionality is, ... the simplest way to a solution. ... I haven't used a "GoTo" in more years ...
    (borland.public.delphi.non-technical)
  • Re: If exist batch command not working in WinXp
    ... echo file not exists ... The batch file is in the dir C\temp. ...
    (microsoft.public.windowsxp.newusers)