batch files, using xcopy or copy

Posted on 2005-04-11
Last Modified: 2010-04-14
I have a scheduled batch file that I want to copy a file to a network drive.  The network drive requires a password.  How do I supply it?


C:\>copy foo.txt \\blah\moo
Logon failure: unknown user name or bad password.
        0 file(s) copied.
Question by:thunderchicken
    LVL 82

    Accepted Solution

    Map a connection to IPC$:
    net use \\blah\IPC$ SomePassword /user:SomeDomain\SomeUser
    copy foo.txt \\blah\moo
    net use \\blah\IPC$ /delete

    Or map a drive with the same syntax (net use X: \\blah\moo SomePassword /user:SomeDomain\SomeUser), but in those cases, I prefer the IPC$ share and UNC paths; doesn't collide with existing drive letters.
    LVL 16

    Expert Comment

    Go into the Start button > Programs > Accessories > System Tools > Scheduled Tasks. Double click your task to view the properties. At the Task tab there is a button that says Set Password. Click and enter the password. Also, the username should be a user that has permissions to access the share. It should be domain\username.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    For Sennheiser, comfort, quality and security are high priority areas. This paper addresses the security of Bluetooth technology and the supplementary security that Sennheiser’s Contact Center and Office (CC&O) headsets provide.  
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    779 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

    19 Experts available now in Live!

    Get 1:1 Help Now