Using CALL command to execute remote BAT file

Within my local BAT file i have the following:

call "\\server\BatchLogin$\tflogin.bat" /user:domain1\user1 password

However i get the error  "Logon Failure: unknown user name or bad password"

I know the user does have access to the file. Is there an error in my syntax?
Who is Participating?
I think that „/user:” parameter isn’t valid one for „call” command.
I think that first of all you should run “call” command by “runas” by context of user with have required permission on file server with is located on your network.
You are passing two parameters....

where the /user switch and name are one param, password is another....

inside your bat you should have them assigned as $1 and $2 against the command you are passing....

of course it would help to see the command you are running inside the bat file :)
Runas /user:domain1\user1 “call \\server\BatchLogin$\tflogin.bat” should work.
But in this scenario you have to provide password manually
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Avatar, Just for clarity, is BatchLogin$ is secured and you are trying to authenticate to it from another batch file to run tflogin? Or is the BatchLogin$ read only for all and you are trying to pass a username and password into the batch file?
Avatar261Author Commented:
I think i figured it out. Thanks for all your comments.

The command actually works fine. After relogging it it just worked.

I was then receiving a 1219 error as the tflogin.bat file was mapping drives with the same authentication. When i removed the authentication from that file it all works fine.

I gather because you authenticate via the first bat file it isn't needed in the second unless you want to use a completely different user.

Do you think points should be assigned or is it an answer i have figured?
If it was I. I would give hoodlum_1978 some points as he did point out that the user parameter was incorrect as your first solution. No one asked what was in the batch file so no one knew you where authenticating twice. You can also select your comment as a solution and split the points with him.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.