locked
Cannot run custom bat script after running vcvarsall.bat in Scheulde Task RRS feed

  • Question

  • Dear all,

    I try to add Scehedule Task in Windows 7 to the following

    1. to start a cmd.exe

    2. to change it to VS2010 cmd line for x86

    3. then I run the batch file that is written by my owned "RunAutoTest.bat" that including some MSTest call.

    RunScheduleTest.bat

    cd C:\AppUnitTest\WorkSpace\Bin
    call %comspec% /k ""c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86 
    call RunAutoTest.bat

    And I put it RunScheduleTest.bat as action in the Schedule Task in Windows,

    But I find that it stop after %comspec% call and cannot go to RunAutoTest.bat line.

    Can I know any special on %comspec% ... vcvarsall.bat call?

    Thursday, May 2, 2013 4:39 AM

Answers

  • By "call %comspec% **"  you started new, isolated, nested cmd running environment, that's why your last step never executes(runautotest.bat), if you quit that manually by exit cmd, you find the last step executes.

    My suggestion is not to use %comspec%. Below script works for me:

    C:\AppUnitTest\WorkSpace\Bin
    call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
    call RunAutoTest.bat
    Does it also work for you ?

    Forrest Guo | MSDN Community Support | Feedback to manager

    • Proposed as answer by Forrest Guo Friday, May 3, 2013 5:38 AM
    • Marked as answer by Forrest Guo Friday, May 3, 2013 7:37 AM
    Friday, May 3, 2013 5:37 AM
  • Dear Forrest,

    It's work and thx a lot your help!

    • Marked as answer by TungLee Friday, May 3, 2013 7:20 AM
    Friday, May 3, 2013 7:20 AM

All replies

  • call %comspec% can create Visual Studio dev command environment successfully when I test it, what happens when you execute below on cmd prompt?

    call %comspec% /k ""c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86


    Forrest Guo | MSDN Community Support | Feedback to manager

    Friday, May 3, 2013 3:15 AM
  • Dear Forrest

    my script have 3 steps, and I can complete this, but I find the VS command prompt and stop here...

    and my aims is to start the VS command prompt and run my script that including MSTest...

    Hence how can I proceed the call inside the VS command prompt?

    Best Regards

    Friday, May 3, 2013 4:08 AM
  • By "call %comspec% **"  you started new, isolated, nested cmd running environment, that's why your last step never executes(runautotest.bat), if you quit that manually by exit cmd, you find the last step executes.

    My suggestion is not to use %comspec%. Below script works for me:

    C:\AppUnitTest\WorkSpace\Bin
    call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
    call RunAutoTest.bat
    Does it also work for you ?

    Forrest Guo | MSDN Community Support | Feedback to manager

    • Proposed as answer by Forrest Guo Friday, May 3, 2013 5:38 AM
    • Marked as answer by Forrest Guo Friday, May 3, 2013 7:37 AM
    Friday, May 3, 2013 5:37 AM
  • Dear Forrest,

    It's work and thx a lot your help!

    • Marked as answer by TungLee Friday, May 3, 2013 7:20 AM
    Friday, May 3, 2013 7:20 AM
  • Nice to know that.

    Forrest Guo | MSDN Community Support | Feedback to manager

    Friday, May 3, 2013 7:37 AM