我有一个批处理文件(见下面的代码)。因为 tf 命令必须在 Visual Studio 命令提示符下执行。我调用了视觉工作室命令。
但随后批处理文件停止执行。有人有想法吗?
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"