-2

Syntax for batch File for IF then ELSE

How to create batch File which can check if file exists then exit out else create new file?

BradleyDotNET
  • 60,462
  • 10
  • 96
  • 117
  • 1
    possible duplicate of [How to verify if a file exists in a Windows .BAT file?](http://stackoverflow.com/questions/3022176/how-to-verify-if-a-file-exists-in-a-windows-bat-file) – stuartd Jun 18 '14 at 00:02
  • We always strive to write correct syntax, no need to include it in the question. It also makes an otherwise valid question look like a "give me teh codez" type question (which it sort of is, but there are worse). – BradleyDotNET Jun 18 '14 at 00:05
  • It would help if you had some relevant code that you have tried to use. – benRollag Jun 18 '14 at 00:22

1 Answers1

0

An example:

@echo off
set "$file=the_file.txt"
if exist %$file% (exit) else (echo new>%$file%)
SachaDee
  • 9,245
  • 3
  • 23
  • 33