title: Creating a folder on a remote server using batch file from teamcity build agent
body: <p>I am trying to create a folder on a remote machine by running the batch file from teamcity and then copy source into that folder but it seems to be not doing. 
  Using following code to create and copy</p>
  
  <pre><code>SET dirTempBackup=\\server1\BackupStorage\temp\test
  SET Current=\\server1\web\BuildEnvironment\test
  
   ECHO Starting to copy files.
   IF NOT EXIST "%dirTempBackup%" MKDIR "%dirTempBackup%"
   IF NOT EXIST "!Current!" (
  ECHO ERROR! Not found: !Current!
   ) ELSE (
  ECHO Copying: !Current!
  SET Destination=%dirTempBackup%\!Current:~0,1!
  REM Directory.
  XCOPY "!Current!" "!Destination!" /v /c /i /g /h /q /r /y /e
  )
  </code></pre>
  
  <p>using the temp directory as compressing it later and then deleeting it at the end. Teamcity is generating Access is denied. and Copy failing due to Invalid path. Have checked teamcity user has full rights on that folder.</p>