batch file - Parenthesis on Filename for DOS -


i'm writing script copy old files different folder.

i'm basing script http://www.dostips.com/dttipsdatetime.php

everything runs smoothly until check file named

search_results_2014-04-16_142612(keywordsbroad-exact).xls 

there seems error line 31 of code:

) else (for /f %%a in ('"dir %attr% /-c "%file%"|findstr "^^[0-9]""') call:jdate jd "%%a") 

i believe "(" , "")" causing problem. tried adding ^( , %%( statement keep getting error message..

the error message .xls"|findstr "^[0-9]"" unexpected @ time.

any advice?

the outer double quotes causing problem. there make don't need escape |, causing problems %file% because not quoted properly, leaving ) exposed, prematurely closing in() clause. fix remove outer quotes , escape pipe. also, caret quoted, no need escape it:

) else (for /f %%a in ('dir %attr% /-c "%file%"^|findstr "^[0-9]"') call :jdate jd "%%a") 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -