Solved

xcopy to mapped drive windows 8

Posted on 2013-01-10
8
1,870 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
DevOps Toolchain Recommendations

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

 
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
 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

The default behavior of the User Account Control (UAC) dialog is to disable (gray-out) the rest of the desktop when prompting for elevation. This is known as secure desktop. There are reasons that you may want to disable this secure desktop behavior…
OfficeMate Freezes on login or does not load after login credentials are input.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
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…

776 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