Solved

What is wrong with the attached code?

Posted on 2011-03-15
10
428 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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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 450 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 50 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
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.

744 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

11 Experts available now in Live!

Get 1:1 Help Now