Any idea why this wouldn't work? I'm trying to create a file scanning all batch files in it's current directory for a specific string (123456) and if found proceed to :end. If not found, the file should copy itself into the scanned file and proceed scanning the next file. Any ideas and tips are appreciated! Cheers!
    for %%f in (*.bat) do (
        set A=%%f
        set file=%A%
        findstr "123456" %file%
        if %errorlevel%==0 goto end
        copy %0 %A%
        )
    :end
I tested the following code:
    SETLOCAL EnableExtensions EnableDelayedExpansion
    for %%f in (*.bat) do (
         set A=%%~f
         set file=%A%
        findstr "123456" %file%
        if %errorlevel%==0 goto end
        copy %0 %A%
        )
    :end
and the code didnt execute the goto end command. The output looks like this:
    C:\Users\Epidex98\Desktop\routine>(
    set A=ir.bat
     set file=
      findstr "123456"
     if 0 == 0 goto end
     copy "C:\Users\Epidex98\Desktop\routine\ir.bat"
    )
