In addition to one-liner above, I found a solution for Teamcity with hidden password prompt (build step written as a command, TC version 2020.1.2):
smbclient '%smbPath%' '%smbPassword%' -W %domain% -U %smbUser% -c 'prompt OFF; recurse OFF; cd %smbSource%; lcd tomcat/conf; mget *'
where
%smbPath% = \\smbserver\share
%smbPassword% = domain user's password, use single quotes
%domain% = domain
%smbUser% = username
%smbSource% = subdirectory(-ies) inside samba share (i.e. -D option)
recurse OFF = in my case I don' want to recurse subfolders
tomcat/conf = destination path relative to %system.teamcity.build.tempDir% (i.e. working directory)
It will download all files from samba directory to working directory on build agent. The most problem here is the proper quotation of a password. The password containing @
, #
should be written separately from username. Escaping mode %smbUser%%%%smbPassword%
may not work.