I have a batch file that I am trying to get working and I'm having trouble suppressing the output of a couple of commands. One solution I've tried is to start the commands with the @
symbol - (something I've done sucessfully plenty of times). Here is the code:
@echo off
setlocal
for /f "tokens=*" %%i in (tmp\hdata.txt) do (
::' just a note - hdata.txt contains lines of text such as,
::' for example:
::' jquery_javascript_32
::' underscore_javascript_9
::' I couldn't do this with simple delimiters because some lines are like:
::' underscore_js_javascript_43
set "id=%%i"
set filewithnum=!id:_javascript_=!
::' *** BELOW throws error ***
@echo !filewithnum!|findstr /R "[0-9]$" && set "file=!filewithnum:~,-1!" >nul 2>&1
::' *** BELOW throws error ***
@echo !filewithnum!|findstr /R "[0-9]$" && set "file=!file:~,-1!" >nul 2>&1
echo !file!
)
endlocal
exit /b
The lines commented above throw: '@echo' is not recognized as an internal or external command, operable program or batch file.
Seems weird.
Any ideas as to what's happening here?
Note: The extra '
after the comment ::
above is to make syntax highlighting work properly on stackoverflow.