Can't run command line script in different directory

I'm trying to run a batch file that I store in subversion.  Relative to the checkout directory it's at


I have a command line runner step set as follows:

Working Directory: trunk\Database\Build\Shared
Run: Executable with parameters
Command Executable: CopySQLBackups.bat

The build fails with:

[15:40:43]: "CopySQLBackups.bat" is not present in directory C:\TeamCity\buildAgent\work\c0ebf743024d92d6
[15:40:43]: Starting: C:\Windows\system32\cmd.exe /c CopySQLBackups.bat \\tco-sql\backups\tco-sql \\tco-dev-sql-02\sqlbakfiles
[15:40:43]: in directory: C:\TeamCity\buildAgent\work\c0ebf743024d92d6\trunk\Database\Build\Shared

I also tried blanking out the working directory and putting the full path to the script in the "Command executable" but got a similar error.  It seems like it's ignoring the value of the working directory parameter.

Can anyone suggest a way to make this work?
Comment actions Permalink

I am using the same steps and trying to run a batch script that is on a different machine. Try sharing a folder on network which is containing that batch file and then try.
My command executable is like this : \\dev-machine\Backup\MyBatchScript.bat. hope it helps

Comment actions Permalink

Thanks - Adding a share with proper permissions fixed it.  I actually had made some other mistakes as well.  One thing that confused me a bit was this message:

"CopySQLBackups.bat" is not present in directory C:\TeamCity\buildAgent\work\c0ebf743024d92d6

Even now that it's working, I still get that message.  So I suppose it's just an info message saying "we looked in the checkout folder but didn't see the script, so instead we'll used the folder you specifed."

Glad to have this resolved.

Comment actions Permalink

Hi John

Could you post a screenshot of the build step settings and full build log.


Comment actions Permalink

As a common practice I would recommend to keep build scripts within version control - that will make builds less depend on network changes.


Please sign in to leave a comment.