0

I need a batch code that will tell me if test.txt is there or not it is in the same directory as the batch file. I would like to know what I should put in the space where it says the code. Can anyone help?

rem the code
echo yes

rem the code
echo no
09stephenb
  • 9,358
  • 15
  • 53
  • 91

1 Answers1

2
IF EXIST yourfilename (
echo Yes 
) ELSE (
echo No
)

Note : ELSE command must be on the same line as the end of the IF command.

To explore more type IF /? in cmd.

Sunny
  • 7,812
  • 10
  • 34
  • 48