0

I am trying to make a batch file that will check certain SVN repositories for updates each morning. I want to store local repository names in a file (SVN_check_list.txt) and have the console show me the list. My code, posted below, works when I just run the batch file:

@echo off
echo Checking for updates...& echo.
for /F %%A in (SVN_check_list.txt) do (
echo Checking '%%A'
svn status %%A -u )
pause

However, when I try to run it through Windows Task Scheduler (while I am logged in), it runs the code but does not display anything until the 'pause' at the end. When I turn echo on, it shows the commands (svn status -u) but not the output. How can I make this batch file display the outputs of the svn status command even when I run it with task scheduler?

2 Answers2

0

Try passing cmd as the Program/Script to run in Scheduler with arguments /k "C:\My Batch File Folder\MyScript.bat"

This will launch the console.

Libin Varghese
  • 1,506
  • 13
  • 19
  • Thanks, I have tried this but the only difference is that the console doesn't close after the pause command. This means I could do away with the pause, which is nice, but it still doesn't show any output. I feel like the issue is with the svn command itself. – Tyler Anderson Feb 28 '17 at 18:51
0

I found this solution that seems to work: Run a batch file with Windows task scheduler

Basically:

  1. Action: Start a program
  2. Program/script: cmd
  3. Add arguments: /k "C:\Users\tanderson\Documents\setup.bat"
  4. Start in: C:\Users\tanderson\Documents (No quotes)
Community
  • 1
  • 1
  • Your question says that you already did this (run a batch file as a Scheduled Task). What specifically needed to change to make it work? – Ben Voigt Apr 18 '17 at 18:59
  • 1st change: the argument I passed into Task Scheduler was /c instead of /k. 2nd change: included 'start "" ' before the path name. 3rd change: included the path in the 'Start in' box. I can't say for sure which of these changes made it work. – Tyler Anderson Apr 19 '17 at 21:10
  • Actually, I just check my original version. It didn't run because it couldn't find SVN_check_list.txt. Maybe I missed that the first time somehow. But as soon as I put the path name in 'Start In' it worked perfectly. I have updated the answer to show the minimal working solution. – Tyler Anderson Apr 19 '17 at 21:19