title: how to check if the variable contains special characters in batch file
body: <p>How can I check whether a variable in my batch file contains special characters or not?
  for example if my variable contains a file-name,then the file-name should not contain characters like <code>\/ &lt; &gt; | : * " ?</code> these.</p>
  
  <pre><code>@echo off
  set param="XXX"
  echo %param%| findstr /r "^[^\\/?%*:|"&lt;&gt;\.]*$"&gt;nul
  
  if %errorlevel% equ 0 goto :next
  echo "Invalid Attribute"
  
  :next
  echo correct
  </code></pre>
  
  <p>I used this link as a reference <a href="https://stackoverflow.com/questions/6222215/regex-for-validating-folder-name-file-name">regex for validating folder name &amp; file name</a></p>