0

I want to create a bat file that will search for xml files from a folder and if one xml file is older than 10 days to show a pop-up message.

The idea is that I don't know how exactly I can do this with if and else.

I know that I can use

forfiles /p "path" /s /m *.xml /d -10 /c "cmd /c echo @file"

for searching the date for the xml files but how to show the message just in case one of the xml is older than 10 days ? In the other case no message.

N G
  • 1
  • Do you just want to echo the filename to the command prompt window? You can't do a "popup box" in pure batch. You'd have to use a vbscript to do that. – Matt Williamson May 06 '13 at 11:44
  • ok, to see the message in cmd then...like "Example.xml" – N G May 06 '13 at 11:50
  • That's what your forfiles command does already. – Matt Williamson May 06 '13 at 12:12
  • yes, but the thing is that I want this message to remain just when a file exists, because I need to use it with automatically tasks. If is no file then the cmd window to close automatically. I need to work with 'if' a xml file is older than 10 days the cmd window with the message to remain opened, 'else' the cmd window to close. This bat file will be executed every day at an specific hour. – N G May 06 '13 at 12:15

1 Answers1

0

This uses your forfiles command - it just changes it to require an enter when the file is echoed

@echo off
forfiles /p "path" /s /m *.xml /d -10 /c "cmd /c set /p var=@file" 
exit
foxidrive
  • 40,353
  • 10
  • 53
  • 68