0

The script below don't work, it doesn't create the file with the ECHO command. If I run the FOR line (changing %% by %) in CMD it's working perfectly. Do you know why ?

SET TXTDATDIR=c:\TEST\EXPORT
SET LOGDIR=c:\TEST\EFALOG
SET TOPDIR=c:\TEST\EFALOG\TOP
IF NOT EXIST %TXTDATDIR%\*.* (
   IF EXIST %LOGDIR%\*.log (
      FOR /R %LOGDIR%\ %%f in (*.log) DO (
          ECHO T > %TOPDIR%\%%~nxf
      )
   )
)

I'm referring to this example : How to get filename only without path in windows command line?

4
  • "don't work" in what way exactly? Apr 5, 2016 at 15:07
  • the ECHO T > %TOPDIR%\%%~nxf is suposed to write in a new file who have the same name as every *.log file in c:\TEST\EFALOG
    – Y-Master
    Apr 5, 2016 at 15:46
  • Your code works here exactly as it is supposed to.
    – DavidPostill
    Apr 5, 2016 at 18:31
  • Thanks David, I will do more test because in my case it seems to never enter in the FOR loop.
    – Y-Master
    Apr 6, 2016 at 7:36

0

You must log in to answer this question.

Browse other questions tagged .