title: Windows Batch : Wrong behavior when double clicked - Works fine on prompt
body: <p>THE QUESTION IS EXACTLY THAT I DID THAT AND NOT WORKED</p>
  
  <p>This script is running fine if I go to the prompt and call the file.bat, get all files *.gsc and clean the lines without that string.</p>
  
  <p>But when I double clicked didn't work as expected, and even the first file is deleted everytime I run, and none of the remaining files were cleaned. :\</p>
  
  <pre><code>@echo off
  set "string_to_find=level.waypoints\["
  for /f "tokens=*" %%a in ('dir /B *.gsc') do (
              set "tempfile=%temp%\%%a"
              if exist "%tempfile%" del "%tempfile%" &gt;NUL
              findstr /C:"%string_to_find%" "%~dp0\%%a" &gt;&gt; "%tempfile%"
              if not errorlevel 1 (
                          del "%%a" &gt;NUL
                          move /Y "%tempfile%" "%~dp0\%%a" &gt;NUL
                          if exist "%tempfile%" del "%tempfile%" &gt;NUL
                          echo File "%~dp0\%%a" processed successfully 
              ) else (
              echo Problem processing file "%~dp0\%%a"
              )
  )
  </code></pre>
  
  <p>I already tryed to use </p>
  
  <pre><code>setlocal enableDelayedExpansion
  </code></pre>
  
  <p>And also replace the vars for "!" instead of "%", but I'm doing something wrong... could you help me pointing what I exact I need to change to make this work also with double click?</p>
  
  <p>thank you!</p>