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 !
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.710Possible duplicate of Command Prompt in Administrator mode doesn't see mapped drives
– Appleoddity – 2019-06-07T12:11:35.4471also, 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.7431
Possible duplicate of Elevated command line prompt can't access shared drives
– Worthwelle – 2019-06-08T02:37:57.373