<pre><code class="lang-auto">if exist <insert file name here> (
rem file exists
) else (
rem file doesn't exist
)
</code></pre>
<p>Or on a single line (if only a single action needs to occur):</p>
<pre><code class="lang-auto">if exist <insert file name here> <action>
</code></pre>
<p>par exemple, this opens notepad on autoexec.bat, if the file exists:</p>
<pre><code class="lang-auto">if exist c:\autoexec.bat notepad c:\autoexec.bat
</code></pre>