Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Using batch file to Backup to another machine  (Read 2177 times)

0 Members and 1 Guest are viewing this topic.

dbdubb

  • Guest
Using batch file to Backup to another machine
« on: September 06, 2006, 09:33:17 AM »
Hello,
I'm trying to write a batch file to backup a certain folder's contents to another machine over the network.

Here's the code I'm using:


echo dave | net use /user:dave x: \\computer2\share
I'm mapping the drive with this line, the user name is dave and the password is dave.
I used the echo command so that when it prompts for a password it would have it to put in, but it doesn't seem to be working right.
Can anybody hlep me out with this.

The next line is working fine, its the first one I'm struggling with.

xcopy c:\aloha\*.* /S /D /Y x:\alohabackupdata\

Thanks in advance.

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Using batch file to Backup to another machine
« Reply #1 on: September 06, 2006, 12:09:30 PM »
Not sure that net use requests the password, but this may work:

Code: [Select]
@echo off
for %%i in (Dave) do net use /user:%%i x: \\computer2\share %%i
xcopy c:\aloha\*.* /S /D /Y x:\alohabackupdata\

You may have to reposition the second %%i.

Good luck.  8-)
« Last Edit: September 06, 2006, 03:16:20 PM by Sidewinder »
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein