Unify the path for environment restore script (#37486)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/37486

Differential Revision: D21326213

Pulled By: ezyang

fbshipit-source-id: 6f0fd07da51439e999026593951396bfc26a2abf
diff --git a/.jenkins/pytorch/win-build.sh b/.jenkins/pytorch/win-build.sh
index 4cb7f4a..bdacee5 100755
--- a/.jenkins/pytorch/win-build.sh
+++ b/.jenkins/pytorch/win-build.sh
@@ -24,6 +24,14 @@
 export TMP_DIR="${PWD}/build/win_tmp"
 export TMP_DIR_WIN=$(cygpath -w "${TMP_DIR}")
 
+# This directory is used only to hold "pytorch_env_restore.bat", called via "setup_pytorch_env.bat"
+CI_SCRIPTS_DIR=$TMP_DIR/ci_scripts
+mkdir -p $CI_SCRIPTS_DIR
+
+if [ -n "$(ls $CI_SCRIPTS_DIR/*)" ]; then
+    rm $CI_SCRIPTS_DIR/*
+fi
+
 export SCRIPT_HELPERS_DIR=$SCRIPT_PARENT_DIR/win-test-helpers
 
 
diff --git a/.jenkins/pytorch/win-test-helpers/build_pytorch.bat b/.jenkins/pytorch/win-test-helpers/build_pytorch.bat
index c4c7c03..2809d7d 100644
--- a/.jenkins/pytorch/win-test-helpers/build_pytorch.bat
+++ b/.jenkins/pytorch/win-test-helpers/build_pytorch.bat
@@ -100,8 +100,8 @@
 )
 
 @echo off
-echo @echo off >> %TMP_DIR_WIN%\bin\pytorch_env_restore.bat
-for /f "usebackq tokens=*" %%i in (`set`) do echo set "%%i" >> %TMP_DIR_WIN%\bin\pytorch_env_restore.bat
+echo @echo off >> %TMP_DIR_WIN%\ci_scripts\pytorch_env_restore.bat
+for /f "usebackq tokens=*" %%i in (`set`) do echo set "%%i" >> %TMP_DIR_WIN%\ci_scripts\pytorch_env_restore.bat
 @echo on
 
 python setup.py install --cmake && sccache --show-stats && (