Running junction.exe from System32 folder not possible in Command Line build step


In TeamCity, we have a build step that runs a .bat file using the "Command Line" Build step which junctions certain folders. However it always fails with the following error:

'C:\Windows\System32\junction.exe' is not recognized as an internal or external command,
operable program or batch file.

I have played around with using the "Custom Script" option and even if I put in the full path (C:\Windows\System32\junction.exe), I still get the same issue. If I copy over junction.exe to the working directory, it seems to work fine.

The build server is running under a user account, and it has access to the System32 folder. It can run other programs such as C:\Windows\System32\sysinfo.exe fine. Also running the script from the Agent work directory works fine too.

Does anybody know why this is?

1 comment
Comment actions Permalink


You can try to run the build agnet from console to see if it makes any difference. See also our notes on investigation steps.

My bet would be that this is Windows 32/64 bit file system tricks. If so, see the comment.


Please sign in to leave a comment.