Computing.Net > Forums > Disk Operating System > If exist doesn't work

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

If exist doesn't work

Reply to Message Icon

Name: solano
Date: May 31, 2008 at 12:02:21 Pacific
OS: dos
CPU/Ram: 4gb
Product: amd
Comment:

echo off
if exist C:\Documents and Settings\solano\Bureau\file.xlsx goto MESSAGE
echo The file C:\Documents and Settings\solano\Bureau\file.xlsx doesn't exist
Pause
goto END
MESSAGE
echo The file C:\Documents and Settings\solano\Bureau\file.xlsx exists

Pause
:END



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: May 31, 2008 at 16:19:06 Pacific
Reply:

Hi

Try quotes around it

if exist "C:\Documents and Settings\solano\Bureau\file.xlsx"


0

Response Number 2
Name: DosX
Date: May 31, 2008 at 16:27:40 Pacific
Reply:

The filename has got spaces. Try to put it in quotes i.e.:

@echo off
if exist "C:\Documents and Settings\solano\Bureau\file.xlsx" goto MESSAGE
echo The file C:\Documents and Settings\solano\Bureau\file.xlsx doesn't exist
Pause
goto END
:MESSAGE
echo The file C:\Documents and Settings\solano\Bureau\file.xlsx exists
Pause
:END


BTW, you forgot to put ":" before MESSAGE label.


0

Response Number 3
Name: Bicephale
Date: June 3, 2008 at 09:50:04 Pacific
Reply:

Full path FileNames of the form
"C:\Documents and Settings\" are
implying that this is a Windows
console problem and hence you're
not posting in the proper forum.

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Salutations,

Michel Samson
a/s Bicéphale


0

Response Number 4
Name: mavis007
Date: June 4, 2008 at 10:44:54 Pacific
Reply:

IF EXIST c:\path\filename.ext goto lable1
IF NOT EXIST c:\path\filename.ext goto lable2

:LABLE1
echo filename exists
goto lable3

:LABLE2
echo filename does not exist
goto lable4

:LABLE3
pause
:: type commands here
goto exit

:LABLE4
pause
:: type commands here
goto exit

:EXIT

Grrrr
wat do I know?
... got brain freeze


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: If exist doesn't work

If exists/errorlevel www.computing.net/answers/dos/if-existserrorlevel/2107.html

command format c: doesn't work www.computing.net/answers/dos/command-format-c-doesnt-work/15366.html

mother board still doesn't work www.computing.net/answers/dos/mother-board-still-doesnt-work/6121.html