title: Execute batch file + call Visual Studio Command Prompt
body: <p>I have a batchfile ( see code below ).
  Because the tf command must be executed in the Visual Studio command prompt.
  I call the visual studio command.</p>
  
  <p>But then the batch file stops executing.
  Somebody have an idea?</p>
  
  <pre><code>        REM @echo off
          REM ... Change the path below. This is the path where the code will be downloaded!
          REM Z:
          REM cd Backup_TFS_Preview
          call %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
  
          REM ... Navigate to folder
          Z:
          cd Backup_TFS_Preview
  
          REM ... Makes folder with date today
          mkdir %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%
  
          REM ... Navigate to folder
          cd %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%
  
          REM ... Add workspace for the folder with date of today
          tf workspace /new %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4% /noprompt
  
          REM ... Get all items from TFS
          tf get /recursive /all /noprompt
  
          REM ... Navigate to folder
          cd ..
  
          REM ... Zip the folder
          C:\TFS_Backup_Scripts\7z.exe a %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%.zip %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%\
  
          REM ... Remove folder
          rmdir %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%\ /s /q
  
          REM ... Delete workspace
          tf workspace /delete %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4% /noprompt
  
          REM ... Navigate to folder
          cd ..
          cd ..
  
          REM ... Delete zip files that are older then 10 days 
          forfiles -p "Z:\Backup_TFS_Preview" -s -m *.* -d -10 -c "cmd /c del /q @path"   
  </code></pre>