[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

batch files, using xcopy or copy

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?

eg:

C:\>copy foo.txt \\blah\moo
Logon failure: unknown user name or bad password.
        0 file(s) copied.
0
thunderchicken
Asked:
thunderchicken
1 Solution
 
oBdACommented:
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.
0
 
craylordCommented:
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.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now