?
Solved

What is wrong with the attached code?

Posted on 2011-03-15
10
Medium Priority
?
446 Views
Last Modified: 2012-05-11
¿I want to write a batch file that would copy a  .bak file  to a folder on a shared drive.
The code I tried is attached. I set it up to run in task scheduler. I get a success message, however nothing happens.
How can I edit this code to it will run correctly?

BTW- I use the  correct IP address in the code    Thanks
copy "F:\SharepointBackups\TESTcontentschedule.bak" "\\IPaddress\shared$\Backups\Sharepoint"

Open in new window

0
Comment
Question by:PDSWSS
10 Comments
 
LVL 6

Expert Comment

by:tangchunfeng
ID: 35144489
make sure you saved the password for the remote host
or add
net use \\192.168.1.199 /user:administrator passwd_of_admin
0
 

Author Comment

by:PDSWSS
ID: 35144559
Is this correct?

net use\\ipaddress\shared$\Backups\Sharepoint/user:administrator password
0
 
LVL 6

Expert Comment

by:tangchunfeng
ID: 35144566
yes
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:Khalid Mehmood Awan
ID: 35144583
You may use attached exe... I have been using it for years for synchronizing two folders on network.
But read its help by typing
SYNC /? when u are in its directory on command prompt.
 sync.exe
0
 

Author Comment

by:PDSWSS
ID: 35144589
Thanks. Concerns me to send my admin password in open text like that. Is there another way?

How would I save the password for the remote host instead?
0
 
LVL 6

Expert Comment

by:tangchunfeng
ID: 35144615
net use  \\ipaddr\sharedir   /user:administrator  passwd /persistent:yes,
0
 
LVL 6

Expert Comment

by:tangchunfeng
ID: 35144623
no need to add in the batch file
run net use /persistent:yes once on your machine
0
 

Author Comment

by:PDSWSS
ID: 35144636
Thanks. I'll test that. Run 1X in the cmd prompt. Correct?

Is there a way to encrypt the password?
0
 
LVL 6

Accepted Solution

by:
tangchunfeng earned 1800 total points
ID: 35144672
run it in cmd prompt

net use  \\192.168.1.199  /user:administrator  /persistent:yes

you will be prompted for the password

no way to encrypt the password in the batch file as far as I know.

0
 
LVL 5

Assisted Solution

by:h4mi
h4mi earned 200 total points
ID: 35146029
For encryption you can make an Autohotkey script and compile it with a password phrase to make an .exe file that's difficult to decompile :

run, "net use \\ipaddr\sharedir /user:administrator passwd /persistent:yes"

download from www.autohotkey.com
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
"Any files you do not have backed up in at least two [other] places are files you do not care about."
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

850 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