Using CALL command to execute remote BAT file

Posted on 2011-04-27
Last Modified: 2012-05-11
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?
Question by:Avatar261
    LVL 2

    Accepted Solution

    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.
    LVL 7

    Expert Comment

    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 :)
    LVL 2

    Expert Comment

    Runas /user:domain1\user1 “call \\server\BatchLogin$\tflogin.bat” should work.
    But in this scenario you have to provide password manually
    LVL 7

    Expert Comment

    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?
    LVL 2

    Author Comment

    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?
    LVL 8

    Expert Comment

    LVL 15

    Expert Comment

    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.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
    Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now