Sql-server – How to transfer files at remote location using sql server job

sql serversqlcmd

I have a job configured in which it transfers the file at remote location.
My command is running absolutely fine from the command prompt but when I configured it in sql server job it gives log on failure unknown user name or bad password.
I am not able to find out the exact reason that why this file is not being transferred.

If there is an error in my code then it should give the same error from the command prompt.
Can anyone help me understand why I am getting the error?

Best Answer

the main reason for failures from batch files with something that works from the command line is the % signs.

On the command line, a single % is required, so for %a in (*.exe) do echo %a works fine, but if you wanted that same command in a batch file, you have to double the % signs, which makes that command now for %%a in (*.exe) do echo %%a

This is only for those that you calculate yourself - using variables like %TEMP% would not change.