I try using
if exist
or
if not exist
on my new Win7 64-bit computer.
Unfortunently, I think they changed the code up, and I really need the code for If Exist in Windows 7 batch Files.
~BAT Beginner
Windows 7 "If Exist" Error.
Moderator: DosItHelp
Re: Windows 7 "If Exist" Error.
Hi BAT Beginner,
I don't believe that the syntax is changed. Would you show us the entire line or code?
Regards
aGerman
I don't believe that the syntax is changed. Would you show us the entire line or code?
Regards
aGerman
Last edited by aGerman on 29 Jan 2010 17:50, edited 1 time in total.
-
- Posts: 16
- Joined: 29 Jan 2010 17:19
Re: Windows 7 "If Exist" Error.
Code: Select all
@echo off
if exist help.txt
goto yes
if not exist help.txt
goto no
:yes
Echo You Do have help.txt in this folder.
pause
:no
Echo You Do not have help.txt in this folder.
pause
Re: Windows 7 "If Exist" Error.
You have to use it in one line with the command that should be executed.
For your example:
Regards
aGerman
For your example:
Code: Select all
@echo off &setlocal
if not exist help.txt goto no
Echo You Do have help.txt in this folder.
pause
goto :eof
:no
Echo You Do not have help.txt in this folder.
pause
Regards
aGerman
-
- Posts: 16
- Joined: 29 Jan 2010 17:19
Re: Windows 7 "If Exist" Error.
Thank you So Much!
You are so Helpful!
~BAT Beginner
You are so Helpful!
~BAT Beginner