Solved

xcopy to mapped drive windows 8

Posted on 2013-01-10
8
1,841 Views
Last Modified: 2013-01-16
The below command works for me in windows xp and windows 7, however I have a new build in windows 8 and it no longer works.  It says "Invalid Drive Specification"

The p: drive is a mapped network drive.  I think it has something to do with that because if I simply change the p: to e: (local drive) the xcopy command works.  

I can change directory to the P:\ path from command-line, shrug...

xcopy %USERPROFILE%\Favorites\*.* p:\backups\%username%\Favorites\ /s /y

Open in new window

0
Comment
Question by:icecom4
  • 4
  • 3
8 Comments
 
LVL 3

Expert Comment

by:zackmccracken
Comment Utility
could you try using quotes around the destination location "p:\backups\%username%\Favorites\"  ?
0
 
LVL 2

Expert Comment

by:bcruse32347
Comment Utility
According to documentation this command should work. Have you checked the command prompt to see if you can see files and folders in p: drive and navigate the folders?
0
 

Author Comment

by:icecom4
Comment Utility
@ Zack
yes, I tryed quotes on the destination, I also tried quotes on source, separately and both.  

@ Bcr
it creates the folders, then stops

but, this gets stranger.  I just ran it not using "run as administrator" and it works.  I am not clapping for joy, because I do not understand why this is happening.  Most of my batches require to be ran as administrator on Win7/8, this is the first time I have seen something not work as admin.  

It means I cannot include this script in some of the other batches which require run as admin, kind of annoying.  

Any thoughts on why this is happening?  Is it perhaps that run as admin causes it to drop authentication for the mapped drive?  I don't know why that would be, I shared it to everyone group.
0
 
LVL 3

Expert Comment

by:zackmccracken
Comment Utility
run as admin is a different user and does not have the mapping you have created with your own user
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:icecom4
Comment Utility
A)  Is there a way to map the same mapped drive to administrator then?  

or

B) how can I run the command as the existing user from another batch file?  
runas won't work because it haults for a password, stopping the whole script.
0
 

Accepted Solution

by:
icecom4 earned 0 total points
Comment Utility
I think I found the solution to the A problem here...
http://www.winhelponline.com/blog/mapped-drives-are-not-seen-from-elevated-command-prompt-in-vista/

Any advise on B though?
0
 
LVL 3

Assisted Solution

by:zackmccracken
zackmccracken earned 500 total points
Comment Utility
make sure you run the script with the same user as mapping the drive with

or schedule to run the batch file from a scheduled task with a specific user
you can run a batch from within a batch with the call command.
0
 

Author Closing Comment

by:icecom4
Comment Utility
This link has the exact solution to the problem.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

772 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