Solved

xcopy to mapped drive windows 8

Posted on 2013-01-10
8
1,856 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
ID: 38764468
could you try using quotes around the destination location "p:\backups\%username%\Favorites\"  ?
0
 
LVL 2

Expert Comment

by:bcruse32347
ID: 38764481
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
ID: 38764735
@ 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
ID: 38764792
run as admin is a different user and does not have the mapping you have created with your own user
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:icecom4
ID: 38764827
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
ID: 38764851
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
ID: 38764871
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
ID: 38782027
This link has the exact solution to the problem.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Detailed instructions on how to install an Access add-in in recent versions of Office and Windows (with screen shots)
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…

920 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