Solved

xcopy to mapped drive windows 8

Posted on 2013-01-10
8
1,894 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
If you use NetMotion Mobility on your PC and plan to upgrade to Windows 10, it may not work unless you take these steps.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

733 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