Shared Folder not accessible from Admin

1

I'm using a Win7 VM ith VMWare. I setup a shared folder to access some file of my host machine. Now I'm trying to access it through a batch script :

xcopy /y "Z:\Desktop\test\*" "C:\Users\%username%\Desktop\test\"

It's working when I launch the script normally, but not when executing it as admin..

Of course the rest of the script needs admin rights, that's why I execute this script as an admin.

I know that it is probably easy to fix but I didn't find how and I'm fed up to go round in circles..

Thanks !

Maxime Droid

Posted 2019-06-07T10:20:58.957

Reputation: 11

Use UNC paths. Otherwise enable linked connections: http://woshub.com/how-to-access-mapped-network-drives-from-the-elevated-apps/. It’s been like this since Vista.

– Appleoddity – 2019-06-07T12:10:46.710

Possible duplicate of Command Prompt in Administrator mode doesn't see mapped drives

– Appleoddity – 2019-06-07T12:11:35.447

1also, if the user account you're on is not the one with admin privileges (i.e. UAC prompts you for your admin password), %username% will be something different (it's the username of the account running the script). – mael' – 2019-06-07T12:48:06.743

1

Possible duplicate of Elevated command line prompt can't access shared drives

– Worthwelle – 2019-06-08T02:37:57.373

No answers